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:
14
src/Spec.js
14
src/Spec.js
@@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user