Start of before/after refactor. Yank defineGetter on nestedResults. rake build task now sorts sources to minimize jasmine.js changes post-build

This commit is contained in:
ragaskar
2009-08-01 10:43:03 -07:00
parent 60f513cbff
commit d5489a3e0d
5 changed files with 644 additions and 623 deletions

View File

@@ -145,7 +145,10 @@ jasmine.Spec.prototype.execute = function() {
jasmine.Spec.prototype.safeExecuteBefores = function() {
var befores = [];
for (var suite = this.suite; suite; suite = suite.parentSuite) {
if (suite.beforeEachFunction) befores.push(suite.beforeEachFunction);
if (suite.beforeQueue) {
for (var i = 0; i < suite.beforeQueue.length; i++)
befores.push(suite.beforeQueue[i]);
}
}
while (befores.length) {
@@ -154,8 +157,15 @@ jasmine.Spec.prototype.safeExecuteBefores = function() {
};
jasmine.Spec.prototype.safeExecuteAfters = function() {
var afters = [];
for (var suite = this.suite; suite; suite = suite.parentSuite) {
if (suite.afterEachFunction) this.safeExecuteBeforeOrAfter(suite.afterEachFunction);
if (suite.afterQueue) {
for (var i = 0; i < suite.afterQueue.length; i++)
afters.unshift(suite.afterQueue[i]);
}
}
while (afters.length) {
this.safeExecuteBeforeOrAfter(afters.pop());
}
};

View File

@@ -15,8 +15,8 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
this.specs = this.actions;
this.parentSuite = parentSuite;
this.beforeEachFunction = null;
this.afterEachFunction = null;
this.beforeQueue = [];
this.afterQueue = [];
};
jasmine.util.inherit(jasmine.Suite, jasmine.ActionCollection);
@@ -34,12 +34,12 @@ jasmine.Suite.prototype.finishCallback = function() {
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
beforeEachFunction.typeName = 'beforeEach';
this.beforeEachFunction = beforeEachFunction;
this.beforeQueue.push(beforeEachFunction);
};
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
afterEachFunction.typeName = 'afterEach';
this.afterEachFunction = afterEachFunction;
this.afterQueue.push(afterEachFunction);
};
jasmine.Suite.prototype.getResults = function() {