Skip to content

Commit

Permalink
patching test#chain to accept string callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
alunny committed Nov 24, 2010
1 parent c345d6f commit a9e3dd2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions spec/public/lawnchair-spec.js
Expand Up @@ -7,12 +7,18 @@ var chain = function(tests, delay) {
chain(tests, delay);
}, delay);
} else {
return function() {
tests.shift().apply({
next:function() {
return chain(tests);
}
}, arguments);
var nextTest = tests.shift();
var next = { next: function () {
return chain(tests);
} };

if (typeof nextTest == "string") {
window.thisChain = next;
return nextTest;
} else {
return function () {
nextTest.apply(next, arguments);
}
}
}
} else QUnit.start();
Expand Down Expand Up @@ -92,9 +98,8 @@ module('Lawnchair', {
ok(true, 'should call passed in callback');
equals(one, me, 'should pass in original saved object in callback');
store.save({something:'else'}, this.next());
}, function(all) {
store.all(this.next());
}, function(two) {
}, "store.all(window.thisChain.next());"
, function(two) {
equals(two.length, 2, 'should have length 2 after saving two objects');
store.save({key:testid, foo:'bar'}, this.next());
}, function(three) {
Expand Down

0 comments on commit a9e3dd2

Please sign in to comment.