JsApiReporter reports nested suites correctly.

Runner#topLevelSuites() returns only top level suites.
Suite#specs(), Suite#suites(), and Suite#children() return immediate children.
This commit is contained in:
Lee Byrd & Christian Williams
2010-06-22 10:18:22 -07:00
parent c187adc096
commit e30b99e7b3
8 changed files with 191 additions and 100 deletions

View File

@@ -16,6 +16,8 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
self.env = env;
self.before_ = [];
self.after_ = [];
self.children_ = [];
self.suites_ = [];
self.specs_ = [];
};
@@ -50,7 +52,9 @@ jasmine.Suite.prototype.results = function() {
};
jasmine.Suite.prototype.add = function(block) {
this.children_.push(block);
if (block instanceof jasmine.Suite) {
this.suites_.push(block);
this.env.currentRunner().addSuite(block);
} else {
this.specs_.push(block);
@@ -62,6 +66,14 @@ jasmine.Suite.prototype.specs = function() {
return this.specs_;
};
jasmine.Suite.prototype.suites = function() {
return this.suites_;
};
jasmine.Suite.prototype.children = function() {
return this.children_;
};
jasmine.Suite.prototype.execute = function(onComplete) {
var self = this;
this.queue.start(function () {