Only clear stack when QueueRunner is done with its functions

This commit is contained in:
Davis W. Frank and Sheel Choksi
2013-07-03 15:20:45 -07:00
parent 34b8bf5fb0
commit 7f6b16ccf2
3 changed files with 28 additions and 22 deletions

View File

@@ -20,9 +20,8 @@ getJasmineRequireObj().QueueRunner = function() {
for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
var fn = fns[iterativeIndex];
if (fn.length > 0) {
attempt(function() { fn.call(self, function() {
self.clearStack(function() { self.run(fns, iterativeIndex + 1); });
});
attempt(function() {
fn.call(self, function() { self.run(fns, iterativeIndex + 1); });
});
return;
} else {
@@ -30,7 +29,12 @@ getJasmineRequireObj().QueueRunner = function() {
}
}
if (iterativeIndex >= length) {
var runnerDone = iterativeIndex >= length,
hasBeenAsyncSpec = recursiveIndex > 0;
if (runnerDone && hasBeenAsyncSpec) {
this.clearStack(this.onComplete);
} else if(runnerDone) {
this.onComplete();
}