From 4cfb7ddd42d79b06d239dbd87612e4706054ea8f Mon Sep 17 00:00:00 2001 From: pivotal Date: Tue, 28 Jul 2009 17:27:52 -0700 Subject: [PATCH] carl/bosh - merge pockets pudge changes in and update bootstrap to include some missing src files --- lib/jasmine.js | 13 +++++++++---- spec/bootstrap.html | 2 ++ src/Env.js | 1 + src/NestedResults.js | 4 ++-- src/PrettyPrinter.js | 2 +- src/Suite.js | 6 +++++- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/jasmine.js b/lib/jasmine.js index 0954c59..a9c2390 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -587,6 +587,7 @@ jasmine.Env = function() { }; this.nextSpecId_ = 0; + this.nextSuiteId_ = 0; this.equalityTesters_ = []; }; @@ -1465,9 +1466,9 @@ jasmine.NestedResults.prototype.addResult = function(result) { /** * @returns {Boolean} True if everything below passed */ -jasmine.NestedResults.prototype.passed = function() { +jasmine.NestedResults.prototype.__defineGetter__('passed', function() { return this.passedCount === this.totalCount; -}; +}); /** * Base class for pretty printing for expectation results. */ @@ -1498,7 +1499,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { } else if (value instanceof jasmine.Matchers.Any) { this.emitScalar(value.toString()); } else if (typeof value === 'string') { - this.emitScalar("'" + value + "'"); + this.emitScalar(value); } else if (typeof value === 'function') { this.emitScalar('Function'); } else if (typeof value.nodeType === 'number') { @@ -1945,7 +1946,8 @@ jasmine.Spec.prototype.removeAllSpies = function() { */ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { jasmine.ActionCollection.call(this, env); - + + this.id = env.nextSuiteId_++; this.description = description; this.specs = this.actions; this.parentSuite = parentSuite; @@ -1979,6 +1981,9 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) { jasmine.Suite.prototype.getResults = function() { var results = new jasmine.NestedResults(); + results.description = this.description; + results.id = this.id; + for (var i = 0; i < this.specs.length; i++) { results.rollupCounts(this.specs[i].getResults()); } diff --git a/spec/bootstrap.html b/spec/bootstrap.html index c47b3b1..19aa1a8 100755 --- a/spec/bootstrap.html +++ b/spec/bootstrap.html @@ -15,7 +15,9 @@ + + diff --git a/src/Env.js b/src/Env.js index fd4dc70..851adce 100644 --- a/src/Env.js +++ b/src/Env.js @@ -18,6 +18,7 @@ jasmine.Env = function() { }; this.nextSpecId_ = 0; + this.nextSuiteId_ = 0; this.equalityTesters_ = []; }; diff --git a/src/NestedResults.js b/src/NestedResults.js index c5fabf7..4e4842f 100644 --- a/src/NestedResults.js +++ b/src/NestedResults.js @@ -75,6 +75,6 @@ jasmine.NestedResults.prototype.addResult = function(result) { /** * @returns {Boolean} True if everything below passed */ -jasmine.NestedResults.prototype.passed = function() { +jasmine.NestedResults.prototype.__defineGetter__('passed', function() { return this.passedCount === this.totalCount; -}; +}); diff --git a/src/PrettyPrinter.js b/src/PrettyPrinter.js index 9d8f4f9..9bf7083 100644 --- a/src/PrettyPrinter.js +++ b/src/PrettyPrinter.js @@ -28,7 +28,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { } else if (value instanceof jasmine.Matchers.Any) { this.emitScalar(value.toString()); } else if (typeof value === 'string') { - this.emitScalar("'" + value + "'"); + this.emitScalar(value); } else if (typeof value === 'function') { this.emitScalar('Function'); } else if (typeof value.nodeType === 'number') { diff --git a/src/Suite.js b/src/Suite.js index 60ac46c..9113eca 100644 --- a/src/Suite.js +++ b/src/Suite.js @@ -9,7 +9,8 @@ */ jasmine.Suite = function(env, description, specDefinitions, parentSuite) { jasmine.ActionCollection.call(this, env); - + + this.id = env.nextSuiteId_++; this.description = description; this.specs = this.actions; this.parentSuite = parentSuite; @@ -43,6 +44,9 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) { jasmine.Suite.prototype.getResults = function() { var results = new jasmine.NestedResults(); + results.description = this.description; + results.id = this.id; + for (var i = 0; i < this.specs.length; i++) { results.rollupCounts(this.specs[i].getResults()); }