Refactor Suite.addSpec and .addSuite to .addChild

This commit is contained in:
Sheel Choksi and Tim Jarratt
2013-10-25 10:52:31 -07:00
parent 26581b4c91
commit 29c5c127e5
3 changed files with 6 additions and 11 deletions

View File

@@ -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);

View File

@@ -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;
};

View File

@@ -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) {