Skip to content

Commit

Permalink
Regenerate jasmine.js after adding ensured support.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgould committed Jul 24, 2012
1 parent 1c2e50d commit ddd48f2
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions lib/jasmine-core/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1964,22 +1964,41 @@ jasmine.StringPrettyPrinter.prototype.append = function(value) {
};
jasmine.Queue = function(env) {
this.env = env;

// parallel to blocks. each true value in this array means the block will
// get executed even if we abort
this.ensured = [];
this.blocks = [];
this.running = false;
this.index = 0;
this.offset = 0;
this.abort = false;
};

jasmine.Queue.prototype.addBefore = function(block) {
jasmine.Queue.prototype.addBefore = function(block, ensure) {
if (ensure === jasmine.undefined) {
ensure = false;
}

this.blocks.unshift(block);
this.ensured.unshift(ensure);
};

jasmine.Queue.prototype.add = function(block) {
jasmine.Queue.prototype.add = function(block, ensure) {
if (ensure === jasmine.undefined) {
ensure = false;
}

this.blocks.push(block);
this.ensured.push(ensure);
};

jasmine.Queue.prototype.insertNext = function(block) {
jasmine.Queue.prototype.insertNext = function(block, ensure) {
if (ensure === jasmine.undefined) {
ensure = false;
}

this.ensured.splice((this.index + this.offset + 1), 0, ensure);
this.blocks.splice((this.index + this.offset + 1), 0, block);
this.offset++;
};
Expand All @@ -2003,7 +2022,7 @@ jasmine.Queue.prototype.next_ = function() {
while (goAgain) {
goAgain = false;

if (self.index < self.blocks.length && !this.abort) {
if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) {
var calledSynchronously = true;
var completedSynchronously = false;

Expand Down Expand Up @@ -2294,7 +2313,7 @@ jasmine.Spec.prototype.finish = function(onComplete) {

jasmine.Spec.prototype.after = function(doAfter) {
if (this.queue.isRunning()) {
this.queue.add(new jasmine.Block(this.env, doAfter, this));
this.queue.add(new jasmine.Block(this.env, doAfter, this), true);
} else {
this.afterCallbacks.unshift(doAfter);
}
Expand Down Expand Up @@ -2332,15 +2351,15 @@ jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
}
for (i = 0; i < this.afterCallbacks.length; i++) {
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this), true);
}
for (suite = this.suite; suite; suite = suite.parentSuite) {
for (i = 0; i < suite.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this), true);
}
}
for (i = 0; i < runner.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this), true);
}
};

Expand Down

0 comments on commit ddd48f2

Please sign in to comment.