Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

further fudging of qunit test suite

  • Loading branch information...
commit 4308d275f89bea8ad6618fae111fa95eca839212 1 parent b23af85
@brianleroux authored
View
4 LICENSE
@@ -1,6 +1,6 @@
The MIT License
-Copyright (c) 2009, 2010 Brian LeRoux
+Copyright (c) 2009, 2010, 2011 Brian LeRoux
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+THE SOFTWARE.
View
8 src/adapters/webkit-sqlite.js
@@ -151,7 +151,7 @@ Lawnchair.adapter('webkit-sqlite', (function () {
var that = this
, all = "SELECT * FROM " + this.name
, r = []
- , cb = this.lambda(callback).bind(this) || undefined
+ , cb = this.fn(this.name, callback) || undefined
, win = function (xxx, results) {
if (results.rows.length != 0) {
for (var i = 0, l = results.rows.length; i < l; i++) {
@@ -163,7 +163,7 @@ Lawnchair.adapter('webkit-sqlite', (function () {
if (cb) cb.call(that, r)
}
- this.db.transaction(function (t) {
+ this.db.transaction(function (t) {
t.executeSql(all, [], win, fail)
})
return this
@@ -181,8 +181,8 @@ Lawnchair.adapter('webkit-sqlite', (function () {
nuke: function (cb) {
var nuke = "DELETE FROM " + this.name
, that = this
- , win = cb ? function(){ that.lambda(cb).bind(that)() } : function(){}
- this.db.transaction(function (t) {
+ , win = cb ? function() { that.lambda(cb).call(that) } : function(){}
+ this.db.transaction(function (t) {
t.executeSql(nuke, [], win, fail)
})
return this
View
11 tests/index.html
@@ -9,8 +9,15 @@
<script src="../lib/lawnchair.js" type="text/javascript"></script>
<script src="lawnchair-spec.js" type="text/javascript"></script>
- <script type="text/javascript">
- var store = new Lawnchair({name:'tests'}, function(){})
+ <script type="text/javascript">
+ // autostart seems to be a little eager
+ QUnit.config.autostart = false
+ // kill qunit saves
+ sessionStorage.clear()
+ // kickup the chair
+ var store = new Lawnchair({name:'tests'}, function(){
+ QUnit.start()
+ })
</script>
</head>
<body>
View
32 tests/lawnchair-spec.js
@@ -1,3 +1,5 @@
+
+
module('Lawnchair construction/destruction', {
setup:function() {
},
@@ -80,27 +82,35 @@ test( 'adding, nuking and size tests', function() {
test( 'shorthand callback syntax', function() {
QUnit.stop();
expect(4);
- store.all('ok(true, "shorthand syntax callback gets evaled"); same(this, store, "`this` should be scoped to the Lawnchair instance"); QUnit.start();') ;
- stop()
+ store.all('ok(true, "shorthand syntax callback gets evaled"); same(this, store, "`this` should be scoped to the Lawnchair instance"); QUnit.start(); QUnit.stop();') ;
var tmp = new Lawnchair({name:'temps', record:'tmp'}, function(){
+ QUnit.start()
var Temps = this;
equals(this, Temps, 'this is bound to Lawnchair')
- stop()
- Temps.all('start(); ok(temps, "this.name is passed to all callback")')
+ QUnit.stop()
+ Temps.all('ok(temps, "this.name is passed to all callback"); QUnit.start()')
})
})
test('scoped variable in shorthand callback', function() {
- var tmp = new Lawnchair({name:'temps', record:'tmp'}, function(){
- var Temps = this
- stop()
- Temps.each('start(); ok(tmp, "this.record is passed to each callback")')
+ expect(1)
+ QUnit.stop()
+ // FIXME fkn qunit being weird here... expect(1)
+ var tmp = new Lawnchair({name:'temps', record:'tmp'}, function() {
+ this.nuke(function() {
+ this.save({a:1}, function() {
+ this.each('ok(tmp, "this.record is passed to each callback"); QUnit.start()')
+ })
+ })
})
})
module('nuke()', {
setup:function() {
- store.nuke();
+ QUnit.stop();
+ store.nuke(function() {
+ QUnit.start()
+ });
},
teardown:function() {
}
@@ -108,7 +118,8 @@ module('nuke()', {
test( 'chainable', function() {
expect(1);
- same(store.nuke(function() {}), store, 'should be chainable');
+ QUnit.stop()
+ same(store.nuke(function() { QUnit.start() }), store, 'should be chainable');
})
test( 'full callback syntax', function() {
@@ -312,4 +323,3 @@ test( 'remove functionality', function() {
//});
});
});
-*/
Please sign in to comment.
Something went wrong with that request. Please try again.