Refactor Suite.addSpec and .addSuite to .addChild
This commit is contained in:
@@ -106,8 +106,8 @@ describe("Suite", function() {
|
||||
|
||||
spyOn(suite, "execute");
|
||||
|
||||
parentSuite.addSpec(fakeSpec1);
|
||||
parentSuite.addSuite(suite);
|
||||
parentSuite.addChild(fakeSpec1);
|
||||
parentSuite.addChild(suite);
|
||||
|
||||
parentSuite.execute(parentSuiteDone);
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var suite = suiteFactory(description);
|
||||
|
||||
var parentSuite = currentSuite;
|
||||
parentSuite.addSuite(suite);
|
||||
parentSuite.addChild(suite);
|
||||
currentSuite = suite;
|
||||
|
||||
var declarationError = null;
|
||||
@@ -302,7 +302,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.it = function(description, fn) {
|
||||
var spec = specFactory(description, fn, currentSuite);
|
||||
currentSuite.addSpec(spec);
|
||||
currentSuite.addChild(spec);
|
||||
return spec;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,13 +45,8 @@ getJasmineRequireObj().Suite = function() {
|
||||
this.afterFns.unshift(fn);
|
||||
};
|
||||
|
||||
Suite.prototype.addSpec = function(spec) {
|
||||
this.children.push(spec);
|
||||
};
|
||||
|
||||
Suite.prototype.addSuite = function(suite) {
|
||||
suite.parentSuite = this;
|
||||
this.children.push(suite);
|
||||
Suite.prototype.addChild = function(child) {
|
||||
this.children.push(child);
|
||||
};
|
||||
|
||||
Suite.prototype.execute = function(onComplete) {
|
||||
|
||||
Reference in New Issue
Block a user