From 34b479a1a4e2f5c6ed822b771b54c4210706d0c5 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Sat, 10 Oct 2009 10:20:56 -0700 Subject: [PATCH 01/18] Revert "Removed jasmine spec HTML runner (easier to use Rake tasks)" Let's keep it around though so we can run tests without Ruby, eh? This reverts commit e33ecf3665a6fc7cc1b70406248f9ca7979f00ae. --- spec/runner.html | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 spec/runner.html diff --git a/spec/runner.html b/spec/runner.html new file mode 100644 index 0000000..b6dac93 --- /dev/null +++ b/spec/runner.html @@ -0,0 +1,63 @@ + + + + Jasmine Test Runner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From f9b3eff5abf96436bcf5493eaa0707b3af15de10 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Sat, 10 Oct 2009 10:28:19 -0700 Subject: [PATCH 02/18] Got standalone HTML test page working again. --- spec/runner.html | 63 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/spec/runner.html b/spec/runner.html index b6dac93..77ff7f8 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -8,36 +8,63 @@ + + + + - - - + - - - + + + + From d27684d2800d797452117b504ca28673934157c4 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Mon, 12 Oct 2009 17:15:57 -0500 Subject: [PATCH 03/18] Oops, only report results once. --- spec/runner.html | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/spec/runner.html b/spec/runner.html index 77ff7f8..6c02a62 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -71,20 +71,5 @@ - - - \ No newline at end of file From e1ebc1e692f7f01a60062dc845dbb49a7d91a497 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Mon, 12 Oct 2009 17:22:00 -0500 Subject: [PATCH 04/18] Refactor Queue.js. --- src/Queue.js | 61 ++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/src/Queue.js b/src/Queue.js index 27d3737..01ebd10 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -20,49 +20,40 @@ jasmine.Queue.prototype.insertNext = function (block) { }; jasmine.Queue.prototype.start = function(onComplete) { - var self = this; - self.running = true; - self.onComplete = onComplete; - if (self.blocks[0]) { - self.blocks[0].execute(function () { - self._next(); - }); - } else { - self.finish(); - } + this.running = true; + this.onComplete = onComplete; + this.next_(); }; jasmine.Queue.prototype.isRunning = function () { return this.running; }; -jasmine.Queue.prototype._next = function () { +var nestLevel = 0; + +jasmine.Queue.prototype.next_ = function () { var self = this; - var doNext = function () { - self.offset = 0; - self.index++; - if (self.index < self.blocks.length) { - self.blocks[self.index].execute(function () { - self._next(); - }); - } else { - self.finish(); - } - }; - var now = new Date().getTime(); - if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) { - this.env.lastUpdate = now; - this.env.setTimeout(doNext, 0); + if (self.index < self.blocks.length) { + self.blocks[self.index].execute(function () { + var doNext = function () { + self.offset = 0; + self.index++; + self.next_(); + }; + + var now = new Date().getTime(); + if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { + self.env.lastUpdate = now; + self.env.setTimeout(doNext, 0); + } else { + doNext(); + } + }); } else { - doNext(); - } - -}; - -jasmine.Queue.prototype.finish = function () { - this.running = false; - if (this.onComplete) { - this.onComplete(); + self.running = false; + if (self.onComplete) { + self.onComplete(); + } } }; From a3ed49a5ed44c6fae01b3f059cb7e3a64e445f4a Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Mon, 12 Oct 2009 21:02:50 -0500 Subject: [PATCH 05/18] Refactor. --- src/Queue.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Queue.js b/src/Queue.js index 01ebd10..061c222 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -6,7 +6,7 @@ jasmine.Queue = function(env) { this.offset = 0; }; -jasmine.Queue.prototype.addBefore = function (block) { +jasmine.Queue.prototype.addBefore = function(block) { this.blocks.unshift(block); }; @@ -14,7 +14,7 @@ jasmine.Queue.prototype.add = function(block) { this.blocks.push(block); }; -jasmine.Queue.prototype.insertNext = function (block) { +jasmine.Queue.prototype.insertNext = function(block) { this.blocks.splice((this.index + this.offset + 1), 0, block); this.offset++; }; @@ -25,28 +25,27 @@ jasmine.Queue.prototype.start = function(onComplete) { this.next_(); }; -jasmine.Queue.prototype.isRunning = function () { +jasmine.Queue.prototype.isRunning = function() { return this.running; }; var nestLevel = 0; -jasmine.Queue.prototype.next_ = function () { +jasmine.Queue.prototype.next_ = function() { var self = this; if (self.index < self.blocks.length) { self.blocks[self.index].execute(function () { - var doNext = function () { - self.offset = 0; - self.index++; - self.next_(); - }; + self.offset = 0; + self.index++; var now = new Date().getTime(); if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { self.env.lastUpdate = now; - self.env.setTimeout(doNext, 0); + self.env.setTimeout(function() { + self.next_(); + }, 0); } else { - doNext(); + self.next_(); } }); } else { @@ -57,7 +56,7 @@ jasmine.Queue.prototype.next_ = function () { } }; -jasmine.Queue.prototype.results = function () { +jasmine.Queue.prototype.results = function() { var results = new jasmine.NestedResults(); for (var i = 0; i < this.blocks.length; i++) { if (this.blocks[i].results) { From b7549196daa287b421bcea1ab547ca0b07f561e7 Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Mon, 12 Oct 2009 21:23:57 -0500 Subject: [PATCH 06/18] Blocks which complete synchronously have the completion de-nested. Big speed improvement, not quite sure why yet. --- src/Queue.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Queue.js b/src/Queue.js index 061c222..18300d3 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -29,12 +29,20 @@ jasmine.Queue.prototype.isRunning = function() { return this.running; }; -var nestLevel = 0; +jasmine.Queue.UNROLL = true; jasmine.Queue.prototype.next_ = function() { var self = this; if (self.index < self.blocks.length) { - self.blocks[self.index].execute(function () { + var calledSynchronously = true; + var completedSynchronously = false; + + var onComplete = function () { + if (jasmine.Queue.UNROLL && calledSynchronously) { + completedSynchronously = true; + return; + } + self.offset = 0; self.index++; @@ -47,7 +55,13 @@ jasmine.Queue.prototype.next_ = function() { } else { self.next_(); } - }); + }; + self.blocks[self.index].execute(onComplete); + + calledSynchronously = false; + if (completedSynchronously) { + onComplete(); + } } else { self.running = false; if (self.onComplete) { From 5659a1e79eab776dceae58a54d71884b10b17e8d Mon Sep 17 00:00:00 2001 From: Christian Williams Date: Mon, 12 Oct 2009 23:09:51 -0500 Subject: [PATCH 07/18] jasmine.Queue iterates by looping rather than recursing, so stack overflows should be less likely. --- spec/runner.html | 1 + spec/suites/QueueSpec.js | 23 +++++++++++++ src/Queue.js | 73 +++++++++++++++++++++++----------------- 3 files changed, 66 insertions(+), 31 deletions(-) create mode 100644 spec/suites/QueueSpec.js diff --git a/spec/runner.html b/spec/runner.html index 6c02a62..f963bb4 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -39,6 +39,7 @@ 'suites/ExceptionsSpec.js', 'suites/TrivialReporterSpec.js', 'suites/MatchersSpec.js', + 'suites/QueueSpec.js', 'suites/ReporterSpec.js', 'suites/MultiReporterSpec.js', 'suites/PrettyPrintSpec.js', diff --git a/spec/suites/QueueSpec.js b/spec/suites/QueueSpec.js new file mode 100644 index 0000000..59a70f3 --- /dev/null +++ b/spec/suites/QueueSpec.js @@ -0,0 +1,23 @@ +describe("jasmine.Queue", function() { + it("should not call itself recursively, so we don't get stack overflow errors", function() { + var queue = new jasmine.Queue(new jasmine.Env()); + queue.add(new jasmine.Block(null, function() {})); + queue.add(new jasmine.Block(null, function() {})); + queue.add(new jasmine.Block(null, function() {})); + queue.add(new jasmine.Block(null, function() {})); + + var nestCount = 0; + var maxNestCount = 0; + var nextCallCount = 0; + queue.next_ = function() { + nestCount++; + if (nestCount > maxNestCount) maxNestCount = nestCount; + + jasmine.Queue.prototype.next_.apply(queue, arguments); + nestCount--; + }; + + queue.start(); + expect(maxNestCount).toEqual(1); + }); +}); \ No newline at end of file diff --git a/src/Queue.js b/src/Queue.js index 18300d3..c3e064a 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -29,43 +29,54 @@ jasmine.Queue.prototype.isRunning = function() { return this.running; }; -jasmine.Queue.UNROLL = true; +jasmine.Queue.LOOP_DONT_RECURSE = true; jasmine.Queue.prototype.next_ = function() { var self = this; - if (self.index < self.blocks.length) { - var calledSynchronously = true; - var completedSynchronously = false; + var goAgain = true; - var onComplete = function () { - if (jasmine.Queue.UNROLL && calledSynchronously) { - completedSynchronously = true; - return; + while (goAgain) { + goAgain = false; + + if (self.index < self.blocks.length) { + var calledSynchronously = true; + var completedSynchronously = false; + + var onComplete = function () { + if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { + completedSynchronously = true; + return; + } + + self.offset = 0; + self.index++; + + var now = new Date().getTime(); + if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { + self.env.lastUpdate = now; + self.env.setTimeout(function() { + self.next_(); + }, 0); + } else { + if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { + goAgain = true; + } else { + self.next_(); + } + } + }; + self.blocks[self.index].execute(onComplete); + + calledSynchronously = false; + if (completedSynchronously) { + onComplete(); } - - self.offset = 0; - self.index++; - - var now = new Date().getTime(); - if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { - self.env.lastUpdate = now; - self.env.setTimeout(function() { - self.next_(); - }, 0); - } else { - self.next_(); + + } else { + self.running = false; + if (self.onComplete) { + self.onComplete(); } - }; - self.blocks[self.index].execute(onComplete); - - calledSynchronously = false; - if (completedSynchronously) { - onComplete(); - } - } else { - self.running = false; - if (self.onComplete) { - self.onComplete(); } } }; From 3459697cb43c763693eda1a8a5d5203561071407 Mon Sep 17 00:00:00 2001 From: Rajan Agaskar & Ryan Dy Date: Tue, 13 Oct 2009 14:22:47 -0700 Subject: [PATCH 08/18] merge in Queue fixes --- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 1297 +++++++++++---------- lib/jasmine-0.9.0.js | 91 +- 17 files changed, 724 insertions(+), 694 deletions(-) diff --git a/doc/files.html b/doc/files.html index 191b1e7..5a0987d 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index c18596c..dcb0817 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index d1f943c..886f9ff 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index 516de84..c667e5c 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 7c91500..33a043e 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index 8ae2c51..e8abfda 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 86f9536..4216eb5 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 886d6df..f5883e2 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index 7415850..bdf0047 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 81de6a7..1d9baeb 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 8cf1a31..28f5ffa 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index c266cca..9d2ea11 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index d340ac7..0bbfdff 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index a13eb8d..903d803 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:01 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index 67e8988..c5dac05 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Mon Oct 05 2009 22:35:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index 03e6644..75dcaab 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -530,7 +530,7 @@ 523 "major": 0, 524 "minor": 9, 525 "build": 0, -526 "revision": 1254806558 +526 "revision": 1255468384 527 }; 528 /** 529 * @namespace @@ -1490,7 +1490,7 @@ 1483 this.offset = 0; 1484 }; 1485 -1486 jasmine.Queue.prototype.addBefore = function (block) { +1486 jasmine.Queue.prototype.addBefore = function(block) { 1487 this.blocks.unshift(block); 1488 }; 1489 @@ -1498,667 +1498,682 @@ 1491 this.blocks.push(block); 1492 }; 1493 -1494 jasmine.Queue.prototype.insertNext = function (block) { +1494 jasmine.Queue.prototype.insertNext = function(block) { 1495 this.blocks.splice((this.index + this.offset + 1), 0, block); 1496 this.offset++; 1497 }; 1498 1499 jasmine.Queue.prototype.start = function(onComplete) { -1500 var self = this; -1501 self.running = true; -1502 self.onComplete = onComplete; -1503 if (self.blocks[0]) { -1504 self.blocks[0].execute(function () { -1505 self._next(); -1506 }); -1507 } else { -1508 self.finish(); -1509 } -1510 }; -1511 -1512 jasmine.Queue.prototype.isRunning = function () { -1513 return this.running; -1514 }; -1515 -1516 jasmine.Queue.prototype._next = function () { -1517 var self = this; -1518 var doNext = function () { -1519 self.offset = 0; -1520 self.index++; -1521 if (self.index < self.blocks.length) { -1522 self.blocks[self.index].execute(function () { -1523 self._next(); -1524 }); -1525 } else { -1526 self.finish(); -1527 } -1528 }; -1529 var now = new Date().getTime(); -1530 if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) { -1531 this.env.lastUpdate = now; -1532 this.env.setTimeout(doNext, 0); -1533 } else { -1534 doNext(); -1535 } -1536 -1537 }; -1538 -1539 jasmine.Queue.prototype.finish = function () { -1540 this.running = false; -1541 if (this.onComplete) { -1542 this.onComplete(); -1543 } -1544 }; -1545 -1546 jasmine.Queue.prototype.results = function () { -1547 var results = new jasmine.NestedResults(); -1548 for (var i = 0; i < this.blocks.length; i++) { -1549 if (this.blocks[i].results) { -1550 results.addResult(this.blocks[i].results()); -1551 } -1552 } -1553 return results; -1554 }; -1555 -1556 -1557 /* JasmineReporters.reporter -1558 * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to -1559 * descendants of this object to do something with the results (see json_reporter.js) -1560 */ -1561 jasmine.Reporters = {}; -1562 -1563 jasmine.Reporters.reporter = function(callbacks) { -1564 var that = { -1565 callbacks: callbacks || {}, -1566 -1567 doCallback: function(callback, results) { -1568 if (callback) { -1569 callback(results); -1570 } -1571 }, -1572 -1573 reportRunnerResults: function(runner) { -1574 that.doCallback(that.callbacks.runnerCallback, runner); -1575 }, -1576 reportSuiteResults: function(suite) { -1577 that.doCallback(that.callbacks.suiteCallback, suite); -1578 }, -1579 reportSpecResults: function(spec) { -1580 that.doCallback(that.callbacks.specCallback, spec); -1581 }, -1582 log: function (str) { -1583 if (console && console.log) console.log(str); -1584 } -1585 }; -1586 -1587 return that; -1588 }; -1589 -1590 /** -1591 * Runner -1592 * -1593 * @constructor -1594 * @param {jasmine.Env} env -1595 */ -1596 jasmine.Runner = function(env) { -1597 var self = this; -1598 self.env = env; -1599 self.queue = new jasmine.Queue(env); -1600 self.before_ = []; -1601 self.after_ = []; -1602 self.suites_ = []; +1500 this.running = true; +1501 this.onComplete = onComplete; +1502 this.next_(); +1503 }; +1504 +1505 jasmine.Queue.prototype.isRunning = function() { +1506 return this.running; +1507 }; +1508 +1509 jasmine.Queue.LOOP_DONT_RECURSE = true; +1510 +1511 jasmine.Queue.prototype.next_ = function() { +1512 var self = this; +1513 var goAgain = true; +1514 +1515 while (goAgain) { +1516 goAgain = false; +1517 +1518 if (self.index < self.blocks.length) { +1519 var calledSynchronously = true; +1520 var completedSynchronously = false; +1521 +1522 var onComplete = function () { +1523 if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { +1524 completedSynchronously = true; +1525 return; +1526 } +1527 +1528 self.offset = 0; +1529 self.index++; +1530 +1531 var now = new Date().getTime(); +1532 if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { +1533 self.env.lastUpdate = now; +1534 self.env.setTimeout(function() { +1535 self.next_(); +1536 }, 0); +1537 } else { +1538 if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { +1539 goAgain = true; +1540 } else { +1541 self.next_(); +1542 } +1543 } +1544 }; +1545 self.blocks[self.index].execute(onComplete); +1546 +1547 calledSynchronously = false; +1548 if (completedSynchronously) { +1549 onComplete(); +1550 } +1551 +1552 } else { +1553 self.running = false; +1554 if (self.onComplete) { +1555 self.onComplete(); +1556 } +1557 } +1558 } +1559 }; +1560 +1561 jasmine.Queue.prototype.results = function() { +1562 var results = new jasmine.NestedResults(); +1563 for (var i = 0; i < this.blocks.length; i++) { +1564 if (this.blocks[i].results) { +1565 results.addResult(this.blocks[i].results()); +1566 } +1567 } +1568 return results; +1569 }; +1570 +1571 +1572 /* JasmineReporters.reporter +1573 * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to +1574 * descendants of this object to do something with the results (see json_reporter.js) +1575 */ +1576 jasmine.Reporters = {}; +1577 +1578 jasmine.Reporters.reporter = function(callbacks) { +1579 var that = { +1580 callbacks: callbacks || {}, +1581 +1582 doCallback: function(callback, results) { +1583 if (callback) { +1584 callback(results); +1585 } +1586 }, +1587 +1588 reportRunnerResults: function(runner) { +1589 that.doCallback(that.callbacks.runnerCallback, runner); +1590 }, +1591 reportSuiteResults: function(suite) { +1592 that.doCallback(that.callbacks.suiteCallback, suite); +1593 }, +1594 reportSpecResults: function(spec) { +1595 that.doCallback(that.callbacks.specCallback, spec); +1596 }, +1597 log: function (str) { +1598 if (console && console.log) console.log(str); +1599 } +1600 }; +1601 +1602 return that; 1603 }; 1604 -1605 jasmine.Runner.prototype.execute = function() { -1606 var self = this; -1607 if (self.env.reporter.reportRunnerStarting) { -1608 self.env.reporter.reportRunnerStarting(this); -1609 } -1610 self.queue.start(function () { -1611 self.finishCallback(); -1612 }); -1613 }; -1614 -1615 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { -1616 beforeEachFunction.typeName = 'beforeEach'; -1617 this.before_.push(beforeEachFunction); +1605 /** +1606 * Runner +1607 * +1608 * @constructor +1609 * @param {jasmine.Env} env +1610 */ +1611 jasmine.Runner = function(env) { +1612 var self = this; +1613 self.env = env; +1614 self.queue = new jasmine.Queue(env); +1615 self.before_ = []; +1616 self.after_ = []; +1617 self.suites_ = []; 1618 }; 1619 -1620 jasmine.Runner.prototype.afterEach = function(afterEachFunction) { -1621 afterEachFunction.typeName = 'afterEach'; -1622 this.after_.push(afterEachFunction); -1623 }; -1624 -1625 -1626 jasmine.Runner.prototype.finishCallback = function() { -1627 this.env.reporter.reportRunnerResults(this); +1620 jasmine.Runner.prototype.execute = function() { +1621 var self = this; +1622 if (self.env.reporter.reportRunnerStarting) { +1623 self.env.reporter.reportRunnerStarting(this); +1624 } +1625 self.queue.start(function () { +1626 self.finishCallback(); +1627 }); 1628 }; 1629 -1630 jasmine.Runner.prototype.addSuite = function(suite) { -1631 this.suites_.push(suite); -1632 }; -1633 -1634 jasmine.Runner.prototype.add = function(block) { -1635 if (block instanceof jasmine.Suite) { -1636 this.addSuite(block); -1637 } -1638 this.queue.add(block); -1639 }; +1630 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { +1631 beforeEachFunction.typeName = 'beforeEach'; +1632 this.before_.push(beforeEachFunction); +1633 }; +1634 +1635 jasmine.Runner.prototype.afterEach = function(afterEachFunction) { +1636 afterEachFunction.typeName = 'afterEach'; +1637 this.after_.push(afterEachFunction); +1638 }; +1639 1640 -1641 /** @deprecated */ -1642 jasmine.Runner.prototype.getAllSuites = function() { -1643 return this.suites_; -1644 }; -1645 -1646 -1647 jasmine.Runner.prototype.suites = function() { -1648 return this.suites_; -1649 }; -1650 -1651 jasmine.Runner.prototype.results = function() { -1652 return this.queue.results(); -1653 }; -1654 -1655 /** @deprecated */ -1656 jasmine.Runner.prototype.getResults = function() { -1657 return this.queue.results(); -1658 }; -1659 /** -1660 * Internal representation of a Jasmine specification, or test. -1661 * -1662 * @constructor -1663 * @param {jasmine.Env} env -1664 * @param {jasmine.Suite} suite -1665 * @param {String} description -1666 */ -1667 jasmine.Spec = function(env, suite, description) { -1668 if (!env) { -1669 throw new Error('jasmine.Env() required'); -1670 } -1671 ; -1672 if (!suite) { -1673 throw new Error('jasmine.Suite() required'); -1674 } -1675 ; -1676 var spec = this; -1677 spec.id = env.nextSpecId ? env.nextSpecId() : null; -1678 spec.env = env; -1679 spec.suite = suite; -1680 spec.description = description; -1681 spec.queue = new jasmine.Queue(env); -1682 -1683 spec.afterCallbacks = []; -1684 spec.spies_ = []; -1685 -1686 spec.results_ = new jasmine.NestedResults(); -1687 spec.results_.description = description; -1688 spec.matchersClass = null; -1689 }; -1690 -1691 jasmine.Spec.prototype.getFullName = function() { -1692 return this.suite.getFullName() + ' ' + this.description + '.'; -1693 }; -1694 -1695 -1696 jasmine.Spec.prototype.results = function() { -1697 return this.results_; -1698 }; -1699 -1700 jasmine.Spec.prototype.log = function(message) { -1701 return this.results_.log(message); -1702 }; -1703 -1704 /** @deprecated */ -1705 jasmine.Spec.prototype.getResults = function() { -1706 return this.results_; -1707 }; -1708 -1709 jasmine.Spec.prototype.runs = function (func) { -1710 var block = new jasmine.Block(this.env, func, this); -1711 this.addToQueue(block); -1712 return this; +1641 jasmine.Runner.prototype.finishCallback = function() { +1642 this.env.reporter.reportRunnerResults(this); +1643 }; +1644 +1645 jasmine.Runner.prototype.addSuite = function(suite) { +1646 this.suites_.push(suite); +1647 }; +1648 +1649 jasmine.Runner.prototype.add = function(block) { +1650 if (block instanceof jasmine.Suite) { +1651 this.addSuite(block); +1652 } +1653 this.queue.add(block); +1654 }; +1655 +1656 /** @deprecated */ +1657 jasmine.Runner.prototype.getAllSuites = function() { +1658 return this.suites_; +1659 }; +1660 +1661 +1662 jasmine.Runner.prototype.suites = function() { +1663 return this.suites_; +1664 }; +1665 +1666 jasmine.Runner.prototype.results = function() { +1667 return this.queue.results(); +1668 }; +1669 +1670 /** @deprecated */ +1671 jasmine.Runner.prototype.getResults = function() { +1672 return this.queue.results(); +1673 }; +1674 /** +1675 * Internal representation of a Jasmine specification, or test. +1676 * +1677 * @constructor +1678 * @param {jasmine.Env} env +1679 * @param {jasmine.Suite} suite +1680 * @param {String} description +1681 */ +1682 jasmine.Spec = function(env, suite, description) { +1683 if (!env) { +1684 throw new Error('jasmine.Env() required'); +1685 } +1686 ; +1687 if (!suite) { +1688 throw new Error('jasmine.Suite() required'); +1689 } +1690 ; +1691 var spec = this; +1692 spec.id = env.nextSpecId ? env.nextSpecId() : null; +1693 spec.env = env; +1694 spec.suite = suite; +1695 spec.description = description; +1696 spec.queue = new jasmine.Queue(env); +1697 +1698 spec.afterCallbacks = []; +1699 spec.spies_ = []; +1700 +1701 spec.results_ = new jasmine.NestedResults(); +1702 spec.results_.description = description; +1703 spec.matchersClass = null; +1704 }; +1705 +1706 jasmine.Spec.prototype.getFullName = function() { +1707 return this.suite.getFullName() + ' ' + this.description + '.'; +1708 }; +1709 +1710 +1711 jasmine.Spec.prototype.results = function() { +1712 return this.results_; 1713 }; 1714 -1715 jasmine.Spec.prototype.addToQueue = function (block) { -1716 if (this.queue.isRunning()) { -1717 this.queue.insertNext(block); -1718 } else { -1719 this.queue.add(block); -1720 } -1721 }; -1722 -1723 /** -1724 * @private -1725 * @deprecated -1726 */ -1727 jasmine.Spec.prototype.expects_that = function(actual) { -1728 return this.expect(actual); -1729 }; -1730 -1731 jasmine.Spec.prototype.expect = function(actual) { -1732 return new (this.getMatchersClass_())(this.env, actual, this.results_); -1733 }; -1734 -1735 jasmine.Spec.prototype.waits = function(timeout) { -1736 var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); -1737 this.addToQueue(waitsFunc); -1738 return this; -1739 }; -1740 -1741 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) { -1742 var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this); -1743 this.addToQueue(waitsForFunc); -1744 return this; -1745 }; -1746 -1747 jasmine.Spec.prototype.fail = function (e) { -1748 this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null)); -1749 }; -1750 -1751 jasmine.Spec.prototype.getMatchersClass_ = function() { -1752 return this.matchersClass || jasmine.Matchers; -1753 }; -1754 -1755 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { -1756 var parent = this.getMatchersClass_(); -1757 var newMatchersClass = function() { -1758 parent.apply(this, arguments); -1759 }; -1760 jasmine.util.inherit(newMatchersClass, parent); -1761 for (var method in matchersPrototype) { -1762 newMatchersClass.prototype[method] = matchersPrototype[method]; -1763 } -1764 this.matchersClass = newMatchersClass; -1765 }; -1766 -1767 jasmine.Spec.prototype.finishCallback = function() { -1768 this.env.reporter.reportSpecResults(this); -1769 }; -1770 -1771 jasmine.Spec.prototype.finish = function(onComplete) { -1772 this.removeAllSpies(); -1773 this.finishCallback(); -1774 if (onComplete) { -1775 onComplete(); -1776 } -1777 }; -1778 -1779 jasmine.Spec.prototype.after = function(doAfter, test) { -1780 -1781 if (this.queue.isRunning()) { -1782 this.queue.add(new jasmine.Block(this.env, doAfter, this)); -1783 } else { -1784 this.afterCallbacks.unshift(doAfter); -1785 } -1786 }; -1787 -1788 jasmine.Spec.prototype.execute = function(onComplete) { -1789 var spec = this; -1790 if (!spec.env.specFilter(spec)) { -1791 spec.results_.skipped = true; -1792 spec.finish(onComplete); -1793 return; -1794 } -1795 this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...'); -1796 -1797 spec.env.currentSpec = spec; -1798 spec.env.currentlyRunningTests = true; -1799 -1800 spec.addBeforesAndAftersToQueue(); -1801 -1802 spec.queue.start(function () { -1803 spec.finish(onComplete); -1804 }); -1805 spec.env.currentlyRunningTests = false; -1806 }; -1807 -1808 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { -1809 var runner = this.env.currentRunner(); -1810 for (var suite = this.suite; suite; suite = suite.parentSuite) { -1811 for (var i = 0; i < suite.before_.length; i++) { -1812 this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); -1813 } -1814 } -1815 for (var i = 0; i < runner.before_.length; i++) { -1816 this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); -1817 } -1818 for (i = 0; i < this.afterCallbacks.length; i++) { -1819 this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); -1820 } -1821 for (suite = this.suite; suite; suite = suite.parentSuite) { -1822 for (var i = 0; i < suite.after_.length; i++) { -1823 this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); -1824 } -1825 } -1826 for (var i = 0; i < runner.after_.length; i++) { -1827 this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); -1828 } -1829 }; -1830 -1831 jasmine.Spec.prototype.explodes = function() { -1832 throw 'explodes function should not have been called'; -1833 }; -1834 -1835 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { -1836 if (obj == undefined) { -1837 throw "spyOn could not find an object to spy upon for " + methodName + "()"; -1838 } -1839 -1840 if (!ignoreMethodDoesntExist && obj[methodName] === undefined) { -1841 throw methodName + '() method does not exist'; -1842 } -1843 -1844 if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { -1845 throw new Error(methodName + ' has already been spied upon'); -1846 } -1847 -1848 var spyObj = jasmine.createSpy(methodName); +1715 jasmine.Spec.prototype.log = function(message) { +1716 return this.results_.log(message); +1717 }; +1718 +1719 /** @deprecated */ +1720 jasmine.Spec.prototype.getResults = function() { +1721 return this.results_; +1722 }; +1723 +1724 jasmine.Spec.prototype.runs = function (func) { +1725 var block = new jasmine.Block(this.env, func, this); +1726 this.addToQueue(block); +1727 return this; +1728 }; +1729 +1730 jasmine.Spec.prototype.addToQueue = function (block) { +1731 if (this.queue.isRunning()) { +1732 this.queue.insertNext(block); +1733 } else { +1734 this.queue.add(block); +1735 } +1736 }; +1737 +1738 /** +1739 * @private +1740 * @deprecated +1741 */ +1742 jasmine.Spec.prototype.expects_that = function(actual) { +1743 return this.expect(actual); +1744 }; +1745 +1746 jasmine.Spec.prototype.expect = function(actual) { +1747 return new (this.getMatchersClass_())(this.env, actual, this.results_); +1748 }; +1749 +1750 jasmine.Spec.prototype.waits = function(timeout) { +1751 var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); +1752 this.addToQueue(waitsFunc); +1753 return this; +1754 }; +1755 +1756 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) { +1757 var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this); +1758 this.addToQueue(waitsForFunc); +1759 return this; +1760 }; +1761 +1762 jasmine.Spec.prototype.fail = function (e) { +1763 this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null)); +1764 }; +1765 +1766 jasmine.Spec.prototype.getMatchersClass_ = function() { +1767 return this.matchersClass || jasmine.Matchers; +1768 }; +1769 +1770 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { +1771 var parent = this.getMatchersClass_(); +1772 var newMatchersClass = function() { +1773 parent.apply(this, arguments); +1774 }; +1775 jasmine.util.inherit(newMatchersClass, parent); +1776 for (var method in matchersPrototype) { +1777 newMatchersClass.prototype[method] = matchersPrototype[method]; +1778 } +1779 this.matchersClass = newMatchersClass; +1780 }; +1781 +1782 jasmine.Spec.prototype.finishCallback = function() { +1783 this.env.reporter.reportSpecResults(this); +1784 }; +1785 +1786 jasmine.Spec.prototype.finish = function(onComplete) { +1787 this.removeAllSpies(); +1788 this.finishCallback(); +1789 if (onComplete) { +1790 onComplete(); +1791 } +1792 }; +1793 +1794 jasmine.Spec.prototype.after = function(doAfter, test) { +1795 +1796 if (this.queue.isRunning()) { +1797 this.queue.add(new jasmine.Block(this.env, doAfter, this)); +1798 } else { +1799 this.afterCallbacks.unshift(doAfter); +1800 } +1801 }; +1802 +1803 jasmine.Spec.prototype.execute = function(onComplete) { +1804 var spec = this; +1805 if (!spec.env.specFilter(spec)) { +1806 spec.results_.skipped = true; +1807 spec.finish(onComplete); +1808 return; +1809 } +1810 this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...'); +1811 +1812 spec.env.currentSpec = spec; +1813 spec.env.currentlyRunningTests = true; +1814 +1815 spec.addBeforesAndAftersToQueue(); +1816 +1817 spec.queue.start(function () { +1818 spec.finish(onComplete); +1819 }); +1820 spec.env.currentlyRunningTests = false; +1821 }; +1822 +1823 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { +1824 var runner = this.env.currentRunner(); +1825 for (var suite = this.suite; suite; suite = suite.parentSuite) { +1826 for (var i = 0; i < suite.before_.length; i++) { +1827 this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); +1828 } +1829 } +1830 for (var i = 0; i < runner.before_.length; i++) { +1831 this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); +1832 } +1833 for (i = 0; i < this.afterCallbacks.length; i++) { +1834 this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); +1835 } +1836 for (suite = this.suite; suite; suite = suite.parentSuite) { +1837 for (var i = 0; i < suite.after_.length; i++) { +1838 this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); +1839 } +1840 } +1841 for (var i = 0; i < runner.after_.length; i++) { +1842 this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); +1843 } +1844 }; +1845 +1846 jasmine.Spec.prototype.explodes = function() { +1847 throw 'explodes function should not have been called'; +1848 }; 1849 -1850 this.spies_.push(spyObj); -1851 spyObj.baseObj = obj; -1852 spyObj.methodName = methodName; -1853 spyObj.originalValue = obj[methodName]; +1850 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { +1851 if (obj == undefined) { +1852 throw "spyOn could not find an object to spy upon for " + methodName + "()"; +1853 } 1854 -1855 obj[methodName] = spyObj; -1856 -1857 return spyObj; -1858 }; -1859 -1860 jasmine.Spec.prototype.removeAllSpies = function() { -1861 for (var i = 0; i < this.spies_.length; i++) { -1862 var spy = this.spies_[i]; -1863 spy.baseObj[spy.methodName] = spy.originalValue; -1864 } -1865 this.spies_ = []; -1866 }; -1867 -1868 /** -1869 * Internal representation of a Jasmine suite. -1870 * -1871 * @constructor -1872 * @param {jasmine.Env} env -1873 * @param {String} description -1874 * @param {Function} specDefinitions -1875 * @param {jasmine.Suite} parentSuite -1876 */ -1877 jasmine.Suite = function(env, description, specDefinitions, parentSuite) { -1878 var self = this; -1879 self.id = env.nextSuiteId ? env.nextSuiteId() : null; -1880 self.description = description; -1881 self.queue = new jasmine.Queue(env); -1882 self.parentSuite = parentSuite; -1883 self.env = env; -1884 self.before_ = []; -1885 self.after_ = []; -1886 self.specs_ = []; -1887 }; -1888 -1889 jasmine.Suite.prototype.getFullName = function() { -1890 var fullName = this.description; -1891 for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { -1892 fullName = parentSuite.description + ' ' + fullName; -1893 } -1894 return fullName; -1895 }; -1896 -1897 jasmine.Suite.prototype.finish = function(onComplete) { -1898 this.env.reporter.reportSuiteResults(this); -1899 this.finished = true; -1900 if (typeof(onComplete) == 'function') { -1901 onComplete(); -1902 } -1903 }; -1904 -1905 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { -1906 beforeEachFunction.typeName = 'beforeEach'; -1907 this.before_.push(beforeEachFunction); -1908 }; -1909 -1910 jasmine.Suite.prototype.afterEach = function(afterEachFunction) { -1911 afterEachFunction.typeName = 'afterEach'; -1912 this.after_.push(afterEachFunction); -1913 }; -1914 -1915 /** @deprecated */ -1916 jasmine.Suite.prototype.getResults = function() { -1917 return this.queue.results(); +1855 if (!ignoreMethodDoesntExist && obj[methodName] === undefined) { +1856 throw methodName + '() method does not exist'; +1857 } +1858 +1859 if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { +1860 throw new Error(methodName + ' has already been spied upon'); +1861 } +1862 +1863 var spyObj = jasmine.createSpy(methodName); +1864 +1865 this.spies_.push(spyObj); +1866 spyObj.baseObj = obj; +1867 spyObj.methodName = methodName; +1868 spyObj.originalValue = obj[methodName]; +1869 +1870 obj[methodName] = spyObj; +1871 +1872 return spyObj; +1873 }; +1874 +1875 jasmine.Spec.prototype.removeAllSpies = function() { +1876 for (var i = 0; i < this.spies_.length; i++) { +1877 var spy = this.spies_[i]; +1878 spy.baseObj[spy.methodName] = spy.originalValue; +1879 } +1880 this.spies_ = []; +1881 }; +1882 +1883 /** +1884 * Internal representation of a Jasmine suite. +1885 * +1886 * @constructor +1887 * @param {jasmine.Env} env +1888 * @param {String} description +1889 * @param {Function} specDefinitions +1890 * @param {jasmine.Suite} parentSuite +1891 */ +1892 jasmine.Suite = function(env, description, specDefinitions, parentSuite) { +1893 var self = this; +1894 self.id = env.nextSuiteId ? env.nextSuiteId() : null; +1895 self.description = description; +1896 self.queue = new jasmine.Queue(env); +1897 self.parentSuite = parentSuite; +1898 self.env = env; +1899 self.before_ = []; +1900 self.after_ = []; +1901 self.specs_ = []; +1902 }; +1903 +1904 jasmine.Suite.prototype.getFullName = function() { +1905 var fullName = this.description; +1906 for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { +1907 fullName = parentSuite.description + ' ' + fullName; +1908 } +1909 return fullName; +1910 }; +1911 +1912 jasmine.Suite.prototype.finish = function(onComplete) { +1913 this.env.reporter.reportSuiteResults(this); +1914 this.finished = true; +1915 if (typeof(onComplete) == 'function') { +1916 onComplete(); +1917 } 1918 }; 1919 -1920 jasmine.Suite.prototype.results = function() { -1921 return this.queue.results(); -1922 }; -1923 -1924 jasmine.Suite.prototype.add = function(block) { -1925 if (block instanceof jasmine.Suite) { -1926 this.env.currentRunner().addSuite(block); -1927 } else { -1928 this.specs_.push(block); -1929 } -1930 this.queue.add(block); -1931 }; -1932 -1933 /** @deprecated */ -1934 jasmine.Suite.prototype.specCount = function() { -1935 return this.specs_.length; -1936 }; -1937 -1938 jasmine.Suite.prototype.specs = function() { -1939 return this.specs_; -1940 }; -1941 -1942 jasmine.Suite.prototype.execute = function(onComplete) { -1943 var self = this; -1944 this.queue.start(function () { -1945 self.finish(onComplete); -1946 }); -1947 }; -1948 jasmine.WaitsBlock = function(env, timeout, spec) { -1949 this.timeout = timeout; -1950 jasmine.Block.call(this, env, null, spec); +1920 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { +1921 beforeEachFunction.typeName = 'beforeEach'; +1922 this.before_.push(beforeEachFunction); +1923 }; +1924 +1925 jasmine.Suite.prototype.afterEach = function(afterEachFunction) { +1926 afterEachFunction.typeName = 'afterEach'; +1927 this.after_.push(afterEachFunction); +1928 }; +1929 +1930 /** @deprecated */ +1931 jasmine.Suite.prototype.getResults = function() { +1932 return this.queue.results(); +1933 }; +1934 +1935 jasmine.Suite.prototype.results = function() { +1936 return this.queue.results(); +1937 }; +1938 +1939 jasmine.Suite.prototype.add = function(block) { +1940 if (block instanceof jasmine.Suite) { +1941 this.env.currentRunner().addSuite(block); +1942 } else { +1943 this.specs_.push(block); +1944 } +1945 this.queue.add(block); +1946 }; +1947 +1948 /** @deprecated */ +1949 jasmine.Suite.prototype.specCount = function() { +1950 return this.specs_.length; 1951 }; 1952 -1953 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); -1954 -1955 jasmine.WaitsBlock.prototype.execute = function (onComplete) { -1956 this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); -1957 this.env.setTimeout(function () { -1958 onComplete(); -1959 }, this.timeout); -1960 }; -1961 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { -1962 this.timeout = timeout; -1963 this.latchFunction = latchFunction; -1964 this.message = message; -1965 this.totalTimeSpentWaitingForLatch = 0; -1966 jasmine.Block.call(this, env, null, spec); -1967 }; -1968 -1969 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); -1970 -1971 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100; -1972 -1973 jasmine.WaitsForBlock.prototype.execute = function (onComplete) { -1974 var self = this; -1975 self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen')); -1976 var latchFunctionResult; -1977 try { -1978 latchFunctionResult = self.latchFunction.apply(self.spec); -1979 } catch (e) { -1980 self.spec.fail(e); -1981 onComplete(); -1982 return; -1983 } -1984 -1985 if (latchFunctionResult) { -1986 onComplete(); -1987 } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) { -1988 var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen'); -1989 self.spec.fail({ -1990 name: 'timeout', -1991 message: message -1992 }); -1993 self.spec._next(); -1994 } else { -1995 self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; -1996 self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); -1997 } -1998 }; -1999 // Mock setTimeout, clearTimeout -2000 // Contributed by Pivotal Computer Systems, www.pivotalsf.com -2001 -2002 jasmine.FakeTimer = function() { -2003 this.reset(); -2004 -2005 var self = this; -2006 self.setTimeout = function(funcToCall, millis) { -2007 self.timeoutsMade++; -2008 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); -2009 return self.timeoutsMade; -2010 }; -2011 -2012 self.setInterval = function(funcToCall, millis) { -2013 self.timeoutsMade++; -2014 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); -2015 return self.timeoutsMade; -2016 }; -2017 -2018 self.clearTimeout = function(timeoutKey) { -2019 self.scheduledFunctions[timeoutKey] = undefined; -2020 }; -2021 -2022 self.clearInterval = function(timeoutKey) { -2023 self.scheduledFunctions[timeoutKey] = undefined; -2024 }; -2025 -2026 }; -2027 -2028 jasmine.FakeTimer.prototype.reset = function() { -2029 this.timeoutsMade = 0; -2030 this.scheduledFunctions = {}; -2031 this.nowMillis = 0; -2032 }; -2033 -2034 jasmine.FakeTimer.prototype.tick = function(millis) { -2035 var oldMillis = this.nowMillis; -2036 var newMillis = oldMillis + millis; -2037 this.runFunctionsWithinRange(oldMillis, newMillis); -2038 this.nowMillis = newMillis; -2039 }; +1953 jasmine.Suite.prototype.specs = function() { +1954 return this.specs_; +1955 }; +1956 +1957 jasmine.Suite.prototype.execute = function(onComplete) { +1958 var self = this; +1959 this.queue.start(function () { +1960 self.finish(onComplete); +1961 }); +1962 }; +1963 jasmine.WaitsBlock = function(env, timeout, spec) { +1964 this.timeout = timeout; +1965 jasmine.Block.call(this, env, null, spec); +1966 }; +1967 +1968 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); +1969 +1970 jasmine.WaitsBlock.prototype.execute = function (onComplete) { +1971 this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); +1972 this.env.setTimeout(function () { +1973 onComplete(); +1974 }, this.timeout); +1975 }; +1976 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { +1977 this.timeout = timeout; +1978 this.latchFunction = latchFunction; +1979 this.message = message; +1980 this.totalTimeSpentWaitingForLatch = 0; +1981 jasmine.Block.call(this, env, null, spec); +1982 }; +1983 +1984 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); +1985 +1986 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100; +1987 +1988 jasmine.WaitsForBlock.prototype.execute = function (onComplete) { +1989 var self = this; +1990 self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen')); +1991 var latchFunctionResult; +1992 try { +1993 latchFunctionResult = self.latchFunction.apply(self.spec); +1994 } catch (e) { +1995 self.spec.fail(e); +1996 onComplete(); +1997 return; +1998 } +1999 +2000 if (latchFunctionResult) { +2001 onComplete(); +2002 } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) { +2003 var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen'); +2004 self.spec.fail({ +2005 name: 'timeout', +2006 message: message +2007 }); +2008 self.spec._next(); +2009 } else { +2010 self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; +2011 self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); +2012 } +2013 }; +2014 // Mock setTimeout, clearTimeout +2015 // Contributed by Pivotal Computer Systems, www.pivotalsf.com +2016 +2017 jasmine.FakeTimer = function() { +2018 this.reset(); +2019 +2020 var self = this; +2021 self.setTimeout = function(funcToCall, millis) { +2022 self.timeoutsMade++; +2023 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); +2024 return self.timeoutsMade; +2025 }; +2026 +2027 self.setInterval = function(funcToCall, millis) { +2028 self.timeoutsMade++; +2029 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); +2030 return self.timeoutsMade; +2031 }; +2032 +2033 self.clearTimeout = function(timeoutKey) { +2034 self.scheduledFunctions[timeoutKey] = undefined; +2035 }; +2036 +2037 self.clearInterval = function(timeoutKey) { +2038 self.scheduledFunctions[timeoutKey] = undefined; +2039 }; 2040 -2041 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { -2042 var scheduledFunc; -2043 var funcsToRun = []; -2044 for (var timeoutKey in this.scheduledFunctions) { -2045 scheduledFunc = this.scheduledFunctions[timeoutKey]; -2046 if (scheduledFunc != undefined && -2047 scheduledFunc.runAtMillis >= oldMillis && -2048 scheduledFunc.runAtMillis <= nowMillis) { -2049 funcsToRun.push(scheduledFunc); -2050 this.scheduledFunctions[timeoutKey] = undefined; -2051 } -2052 } -2053 -2054 if (funcsToRun.length > 0) { -2055 funcsToRun.sort(function(a, b) { -2056 return a.runAtMillis - b.runAtMillis; -2057 }); -2058 for (var i = 0; i < funcsToRun.length; ++i) { -2059 try { -2060 var funcToRun = funcsToRun[i]; -2061 this.nowMillis = funcToRun.runAtMillis; -2062 funcToRun.funcToCall(); -2063 if (funcToRun.recurring) { -2064 this.scheduleFunction(funcToRun.timeoutKey, -2065 funcToRun.funcToCall, -2066 funcToRun.millis, -2067 true); -2068 } -2069 } catch(e) { -2070 } -2071 } -2072 this.runFunctionsWithinRange(oldMillis, nowMillis); -2073 } -2074 }; -2075 -2076 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { -2077 this.scheduledFunctions[timeoutKey] = { -2078 runAtMillis: this.nowMillis + millis, -2079 funcToCall: funcToCall, -2080 recurring: recurring, -2081 timeoutKey: timeoutKey, -2082 millis: millis -2083 }; -2084 }; -2085 -2086 -2087 jasmine.Clock = { -2088 defaultFakeTimer: new jasmine.FakeTimer(), -2089 -2090 reset: function() { -2091 jasmine.Clock.assertInstalled(); -2092 jasmine.Clock.defaultFakeTimer.reset(); -2093 }, -2094 -2095 tick: function(millis) { -2096 jasmine.Clock.assertInstalled(); -2097 jasmine.Clock.defaultFakeTimer.tick(millis); -2098 }, -2099 -2100 runFunctionsWithinRange: function(oldMillis, nowMillis) { -2101 jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); -2102 }, -2103 -2104 scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { -2105 jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); -2106 }, -2107 -2108 useMock: function() { -2109 var spec = jasmine.getEnv().currentSpec; -2110 spec.after(jasmine.Clock.uninstallMock); -2111 -2112 jasmine.Clock.installMock(); +2041 }; +2042 +2043 jasmine.FakeTimer.prototype.reset = function() { +2044 this.timeoutsMade = 0; +2045 this.scheduledFunctions = {}; +2046 this.nowMillis = 0; +2047 }; +2048 +2049 jasmine.FakeTimer.prototype.tick = function(millis) { +2050 var oldMillis = this.nowMillis; +2051 var newMillis = oldMillis + millis; +2052 this.runFunctionsWithinRange(oldMillis, newMillis); +2053 this.nowMillis = newMillis; +2054 }; +2055 +2056 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { +2057 var scheduledFunc; +2058 var funcsToRun = []; +2059 for (var timeoutKey in this.scheduledFunctions) { +2060 scheduledFunc = this.scheduledFunctions[timeoutKey]; +2061 if (scheduledFunc != undefined && +2062 scheduledFunc.runAtMillis >= oldMillis && +2063 scheduledFunc.runAtMillis <= nowMillis) { +2064 funcsToRun.push(scheduledFunc); +2065 this.scheduledFunctions[timeoutKey] = undefined; +2066 } +2067 } +2068 +2069 if (funcsToRun.length > 0) { +2070 funcsToRun.sort(function(a, b) { +2071 return a.runAtMillis - b.runAtMillis; +2072 }); +2073 for (var i = 0; i < funcsToRun.length; ++i) { +2074 try { +2075 var funcToRun = funcsToRun[i]; +2076 this.nowMillis = funcToRun.runAtMillis; +2077 funcToRun.funcToCall(); +2078 if (funcToRun.recurring) { +2079 this.scheduleFunction(funcToRun.timeoutKey, +2080 funcToRun.funcToCall, +2081 funcToRun.millis, +2082 true); +2083 } +2084 } catch(e) { +2085 } +2086 } +2087 this.runFunctionsWithinRange(oldMillis, nowMillis); +2088 } +2089 }; +2090 +2091 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { +2092 this.scheduledFunctions[timeoutKey] = { +2093 runAtMillis: this.nowMillis + millis, +2094 funcToCall: funcToCall, +2095 recurring: recurring, +2096 timeoutKey: timeoutKey, +2097 millis: millis +2098 }; +2099 }; +2100 +2101 +2102 jasmine.Clock = { +2103 defaultFakeTimer: new jasmine.FakeTimer(), +2104 +2105 reset: function() { +2106 jasmine.Clock.assertInstalled(); +2107 jasmine.Clock.defaultFakeTimer.reset(); +2108 }, +2109 +2110 tick: function(millis) { +2111 jasmine.Clock.assertInstalled(); +2112 jasmine.Clock.defaultFakeTimer.tick(millis); 2113 }, 2114 -2115 installMock: function() { -2116 jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; +2115 runFunctionsWithinRange: function(oldMillis, nowMillis) { +2116 jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); 2117 }, 2118 -2119 uninstallMock: function() { -2120 jasmine.Clock.assertInstalled(); -2121 jasmine.Clock.installed = jasmine.Clock.real; -2122 }, -2123 -2124 real: { -2125 setTimeout: window.setTimeout, -2126 clearTimeout: window.clearTimeout, -2127 setInterval: window.setInterval, -2128 clearInterval: window.clearInterval -2129 }, -2130 -2131 assertInstalled: function() { -2132 if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { -2133 throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); -2134 } -2135 }, -2136 -2137 installed: null -2138 }; -2139 jasmine.Clock.installed = jasmine.Clock.real; -2140 -2141 window.setTimeout = function(funcToCall, millis) { -2142 return jasmine.Clock.installed.setTimeout.apply(this, arguments); -2143 }; -2144 -2145 window.setInterval = function(funcToCall, millis) { -2146 return jasmine.Clock.installed.setInterval.apply(this, arguments); -2147 }; -2148 -2149 window.clearTimeout = function(timeoutKey) { -2150 return jasmine.Clock.installed.clearTimeout.apply(this, arguments); -2151 }; -2152 -2153 window.clearInterval = function(timeoutKey) { -2154 return jasmine.Clock.installed.clearInterval.apply(this, arguments); -2155 }; -2156 -2157 \ No newline at end of file +2119 scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { +2120 jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); +2121 }, +2122 +2123 useMock: function() { +2124 var spec = jasmine.getEnv().currentSpec; +2125 spec.after(jasmine.Clock.uninstallMock); +2126 +2127 jasmine.Clock.installMock(); +2128 }, +2129 +2130 installMock: function() { +2131 jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; +2132 }, +2133 +2134 uninstallMock: function() { +2135 jasmine.Clock.assertInstalled(); +2136 jasmine.Clock.installed = jasmine.Clock.real; +2137 }, +2138 +2139 real: { +2140 setTimeout: window.setTimeout, +2141 clearTimeout: window.clearTimeout, +2142 setInterval: window.setInterval, +2143 clearInterval: window.clearInterval +2144 }, +2145 +2146 assertInstalled: function() { +2147 if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { +2148 throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); +2149 } +2150 }, +2151 +2152 installed: null +2153 }; +2154 jasmine.Clock.installed = jasmine.Clock.real; +2155 +2156 window.setTimeout = function(funcToCall, millis) { +2157 return jasmine.Clock.installed.setTimeout.apply(this, arguments); +2158 }; +2159 +2160 window.setInterval = function(funcToCall, millis) { +2161 return jasmine.Clock.installed.setInterval.apply(this, arguments); +2162 }; +2163 +2164 window.clearTimeout = function(timeoutKey) { +2165 return jasmine.Clock.installed.clearTimeout.apply(this, arguments); +2166 }; +2167 +2168 window.clearInterval = function(timeoutKey) { +2169 return jasmine.Clock.installed.clearInterval.apply(this, arguments); +2170 }; +2171 +2172 \ No newline at end of file diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index f32f89a..faec0a5 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -523,7 +523,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1254807302 + "revision": 1255468502 }; /** * @namespace @@ -1483,7 +1483,7 @@ jasmine.Queue = function(env) { this.offset = 0; }; -jasmine.Queue.prototype.addBefore = function (block) { +jasmine.Queue.prototype.addBefore = function(block) { this.blocks.unshift(block); }; @@ -1491,59 +1491,74 @@ jasmine.Queue.prototype.add = function(block) { this.blocks.push(block); }; -jasmine.Queue.prototype.insertNext = function (block) { +jasmine.Queue.prototype.insertNext = function(block) { this.blocks.splice((this.index + this.offset + 1), 0, block); this.offset++; }; jasmine.Queue.prototype.start = function(onComplete) { - var self = this; - self.running = true; - self.onComplete = onComplete; - if (self.blocks[0]) { - self.blocks[0].execute(function () { - self._next(); - }); - } else { - self.finish(); - } + this.running = true; + this.onComplete = onComplete; + this.next_(); }; -jasmine.Queue.prototype.isRunning = function () { +jasmine.Queue.prototype.isRunning = function() { return this.running; }; -jasmine.Queue.prototype._next = function () { +jasmine.Queue.LOOP_DONT_RECURSE = true; + +jasmine.Queue.prototype.next_ = function() { var self = this; - var doNext = function () { - self.offset = 0; - self.index++; + var goAgain = true; + + while (goAgain) { + goAgain = false; + if (self.index < self.blocks.length) { - self.blocks[self.index].execute(function () { - self._next(); - }); + var calledSynchronously = true; + var completedSynchronously = false; + + var onComplete = function () { + if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { + completedSynchronously = true; + return; + } + + self.offset = 0; + self.index++; + + var now = new Date().getTime(); + if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { + self.env.lastUpdate = now; + self.env.setTimeout(function() { + self.next_(); + }, 0); + } else { + if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { + goAgain = true; + } else { + self.next_(); + } + } + }; + self.blocks[self.index].execute(onComplete); + + calledSynchronously = false; + if (completedSynchronously) { + onComplete(); + } + } else { - self.finish(); + self.running = false; + if (self.onComplete) { + self.onComplete(); + } } - }; - var now = new Date().getTime(); - if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) { - this.env.lastUpdate = now; - this.env.setTimeout(doNext, 0); - } else { - doNext(); - } - -}; - -jasmine.Queue.prototype.finish = function () { - this.running = false; - if (this.onComplete) { - this.onComplete(); } }; -jasmine.Queue.prototype.results = function () { +jasmine.Queue.prototype.results = function() { var results = new jasmine.NestedResults(); for (var i = 0; i < this.blocks.length; i++) { if (this.blocks[i].results) { From c164d58a1a8cd71f35bda8aab73dd720adda9d64 Mon Sep 17 00:00:00 2001 From: Rajan Agaskar & Ryan Dy Date: Tue, 13 Oct 2009 14:28:46 -0700 Subject: [PATCH 09/18] Add calls accessor to spies --- src/base.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/base.js b/src/base.js index fe77e01..682438a 100755 --- a/src/base.js +++ b/src/base.js @@ -189,6 +189,7 @@ jasmine.Spy = function(name) { * mySpy.argsForCall[1] = [7, 8]; */ this.argsForCall = []; + this.calls = []; }; /** @@ -283,6 +284,7 @@ jasmine.Spy.prototype.reset = function() { this.wasCalled = false; this.callCount = 0; this.argsForCall = []; + this.calls = []; this.mostRecentCall = {}; }; @@ -292,13 +294,10 @@ jasmine.createSpy = function(name) { spyObj.wasCalled = true; spyObj.callCount++; var args = jasmine.util.argsToArray(arguments); - //spyObj.mostRecentCall = { - // object: this, - // args: args - //}; spyObj.mostRecentCall.object = this; spyObj.mostRecentCall.args = args; spyObj.argsForCall.push(args); + spyObj.calls.push({object: this, args: args}); return spyObj.plan.apply(this, arguments); }; From 92ffcb47e29396f72c5ad57e8ddb0c55c9c540b4 Mon Sep 17 00:00:00 2001 From: Rajan Agaskar & Ryan Dy Date: Tue, 13 Oct 2009 14:48:09 -0700 Subject: [PATCH 10/18] SimpleServer.start now takes optional array of stylesheet paths for runner --- contrib/ruby/jasmine_runner.rb | 9 +- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 3945 ++++++++++----------- lib/jasmine-0.9.0.js | 9 +- 18 files changed, 1996 insertions(+), 1997 deletions(-) diff --git a/contrib/ruby/jasmine_runner.rb b/contrib/ruby/jasmine_runner.rb index 44f3026..ce98c1e 100644 --- a/contrib/ruby/jasmine_runner.rb +++ b/contrib/ruby/jasmine_runner.rb @@ -61,13 +61,14 @@ module Jasmine end class RunAdapter - def initialize(spec_files_or_proc, jasmine_files = nil) + def initialize(spec_files_or_proc, jasmine_files = nil, stylesheets = []) @spec_files_or_proc = spec_files_or_proc @jasmine_files = jasmine_files || [ "/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first), "/__JASMINE_ROOT__/lib/TrivialReporter.js", "/__JASMINE_ROOT__/lib/json2.js" ] + @stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + stylesheets end def call(env) @@ -77,7 +78,7 @@ module Jasmine jasmine_files = @jasmine_files jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call) - css_files = ["/__JASMINE_ROOT__/lib/jasmine.css"] + css_files = @stylesheets body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding) [ @@ -113,12 +114,12 @@ module Jasmine end class SimpleServer - def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil) + def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil, stylesheets = []) require 'thin' config = { '/run.html' => Jasmine::Redirect.new('/'), - '/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files) + '/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files, stylesheets) } mappings.each do |from, to| config[from] = Rack::File.new(to) diff --git a/doc/files.html b/doc/files.html index 5a0987d..e2c07cb 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index dcb0817..b31cb22 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index 886f9ff..95ab2d1 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index c667e5c..e7536c2 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 33a043e..5a0113e 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index e8abfda..1c3ab1d 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 4216eb5..505481e 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index f5883e2..84abe18 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index bdf0047..45b5260 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 1d9baeb..31dd340 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 28f5ffa..5974b47 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index 9d2ea11..235cd81 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index 0bbfdff..43a3c6d 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 903d803..3064179 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index c5dac05..66bbe36 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:15:02 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index 75dcaab..a077a2a 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -196,1984 +196,1983 @@ 189 * mySpy.argsForCall[1] = [7, 8]; 190 */ 191 this.argsForCall = []; -192 }; -193 -194 /** -195 * Tells a spy to call through to the actual implemenatation. -196 * -197 * @example -198 * var foo = { -199 * bar: function() { // do some stuff } -200 * } -201 * -202 * // defining a spy on an existing property: foo.bar -203 * spyOn(foo, 'bar').andCallThrough(); -204 */ -205 jasmine.Spy.prototype.andCallThrough = function() { -206 this.plan = this.originalValue; -207 return this; -208 }; -209 -210 /** -211 * For setting the return value of a spy. -212 * -213 * @example -214 * // defining a spy from scratch: foo() returns 'baz' -215 * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); -216 * -217 * // defining a spy on an existing property: foo.bar() returns 'baz' -218 * spyOn(foo, 'bar').andReturn('baz'); -219 * -220 * @param {Object} value -221 */ -222 jasmine.Spy.prototype.andReturn = function(value) { -223 this.plan = function() { -224 return value; -225 }; -226 return this; -227 }; -228 -229 /** -230 * For throwing an exception when a spy is called. -231 * -232 * @example -233 * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' -234 * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); -235 * -236 * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' -237 * spyOn(foo, 'bar').andThrow('baz'); -238 * -239 * @param {String} exceptionMsg -240 */ -241 jasmine.Spy.prototype.andThrow = function(exceptionMsg) { -242 this.plan = function() { -243 throw exceptionMsg; -244 }; -245 return this; -246 }; -247 -248 /** -249 * Calls an alternate implementation when a spy is called. -250 * -251 * @example -252 * var baz = function() { -253 * // do some stuff, return something -254 * } -255 * // defining a spy from scratch: foo() calls the function baz -256 * var foo = jasmine.createSpy('spy on foo').andCall(baz); -257 * -258 * // defining a spy on an existing property: foo.bar() calls an anonymnous function -259 * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); -260 * -261 * @param {Function} fakeFunc -262 */ -263 jasmine.Spy.prototype.andCallFake = function(fakeFunc) { -264 this.plan = fakeFunc; -265 return this; -266 }; -267 -268 /** -269 * Resets all of a spy's the tracking variables so that it can be used again. -270 * -271 * @example -272 * spyOn(foo, 'bar'); -273 * -274 * foo.bar(); -275 * -276 * expect(foo.bar.callCount).toEqual(1); -277 * -278 * foo.bar.reset(); -279 * -280 * expect(foo.bar.callCount).toEqual(0); -281 */ -282 jasmine.Spy.prototype.reset = function() { -283 this.wasCalled = false; -284 this.callCount = 0; -285 this.argsForCall = []; -286 this.mostRecentCall = {}; -287 }; -288 -289 jasmine.createSpy = function(name) { +192 this.calls = []; +193 }; +194 +195 /** +196 * Tells a spy to call through to the actual implemenatation. +197 * +198 * @example +199 * var foo = { +200 * bar: function() { // do some stuff } +201 * } +202 * +203 * // defining a spy on an existing property: foo.bar +204 * spyOn(foo, 'bar').andCallThrough(); +205 */ +206 jasmine.Spy.prototype.andCallThrough = function() { +207 this.plan = this.originalValue; +208 return this; +209 }; +210 +211 /** +212 * For setting the return value of a spy. +213 * +214 * @example +215 * // defining a spy from scratch: foo() returns 'baz' +216 * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); +217 * +218 * // defining a spy on an existing property: foo.bar() returns 'baz' +219 * spyOn(foo, 'bar').andReturn('baz'); +220 * +221 * @param {Object} value +222 */ +223 jasmine.Spy.prototype.andReturn = function(value) { +224 this.plan = function() { +225 return value; +226 }; +227 return this; +228 }; +229 +230 /** +231 * For throwing an exception when a spy is called. +232 * +233 * @example +234 * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' +235 * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); +236 * +237 * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' +238 * spyOn(foo, 'bar').andThrow('baz'); +239 * +240 * @param {String} exceptionMsg +241 */ +242 jasmine.Spy.prototype.andThrow = function(exceptionMsg) { +243 this.plan = function() { +244 throw exceptionMsg; +245 }; +246 return this; +247 }; +248 +249 /** +250 * Calls an alternate implementation when a spy is called. +251 * +252 * @example +253 * var baz = function() { +254 * // do some stuff, return something +255 * } +256 * // defining a spy from scratch: foo() calls the function baz +257 * var foo = jasmine.createSpy('spy on foo').andCall(baz); +258 * +259 * // defining a spy on an existing property: foo.bar() calls an anonymnous function +260 * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); +261 * +262 * @param {Function} fakeFunc +263 */ +264 jasmine.Spy.prototype.andCallFake = function(fakeFunc) { +265 this.plan = fakeFunc; +266 return this; +267 }; +268 +269 /** +270 * Resets all of a spy's the tracking variables so that it can be used again. +271 * +272 * @example +273 * spyOn(foo, 'bar'); +274 * +275 * foo.bar(); +276 * +277 * expect(foo.bar.callCount).toEqual(1); +278 * +279 * foo.bar.reset(); +280 * +281 * expect(foo.bar.callCount).toEqual(0); +282 */ +283 jasmine.Spy.prototype.reset = function() { +284 this.wasCalled = false; +285 this.callCount = 0; +286 this.argsForCall = []; +287 this.calls = []; +288 this.mostRecentCall = {}; +289 }; 290 -291 var spyObj = function() { -292 spyObj.wasCalled = true; -293 spyObj.callCount++; -294 var args = jasmine.util.argsToArray(arguments); -295 //spyObj.mostRecentCall = { -296 // object: this, -297 // args: args -298 //}; -299 spyObj.mostRecentCall.object = this; -300 spyObj.mostRecentCall.args = args; -301 spyObj.argsForCall.push(args); -302 return spyObj.plan.apply(this, arguments); -303 }; -304 -305 var spy = new jasmine.Spy(name); -306 -307 for(var prop in spy) { -308 spyObj[prop] = spy[prop]; -309 } -310 -311 spyObj.reset(); -312 -313 return spyObj; -314 }; -315 -316 /** -317 * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something -318 * large in one call. -319 * -320 * @param {String} baseName name of spy class -321 * @param {Array} methodNames array of names of methods to make spies -322 */ -323 jasmine.createSpyObj = function(baseName, methodNames) { -324 var obj = {}; -325 for (var i = 0; i < methodNames.length; i++) { -326 obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); -327 } -328 return obj; -329 }; -330 -331 jasmine.log = function(message) { -332 jasmine.getEnv().currentSpec.log(message); -333 }; -334 -335 /** -336 * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. -337 * -338 * @example -339 * // spy example -340 * var foo = { -341 * not: function(bool) { return !bool; } -342 * } -343 * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops -344 * -345 * @see jasmine.createSpy -346 * @param obj -347 * @param methodName -348 * @returns a Jasmine spy that can be chained with all spy methods -349 */ -350 var spyOn = function(obj, methodName) { -351 return jasmine.getEnv().currentSpec.spyOn(obj, methodName); -352 }; -353 -354 /** -355 * Creates a Jasmine spec that will be added to the current suite. -356 * -357 * // TODO: pending tests -358 * -359 * @example -360 * it('should be true', function() { -361 * expect(true).toEqual(true); -362 * }); -363 * -364 * @param {String} desc description of this specification -365 * @param {Function} func defines the preconditions and expectations of the spec -366 */ -367 var it = function(desc, func) { -368 return jasmine.getEnv().it(desc, func); -369 }; -370 -371 /** -372 * Creates a <em>disabled</em> Jasmine spec. -373 * -374 * A convenience method that allows existing specs to be disabled temporarily during development. -375 * -376 * @param {String} desc description of this specification -377 * @param {Function} func defines the preconditions and expectations of the spec -378 */ -379 var xit = function(desc, func) { -380 return jasmine.getEnv().xit(desc, func); -381 }; -382 -383 /** -384 * Starts a chain for a Jasmine expectation. -385 * -386 * It is passed an Object that is the actual value and should chain to one of the many -387 * jasmine.Matchers functions. -388 * -389 * @param {Object} actual Actual value to test against and expected value -390 */ -391 var expect = function(actual) { -392 return jasmine.getEnv().currentSpec.expect(actual); -393 }; -394 -395 /** -396 * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. -397 * -398 * @param {Function} func Function that defines part of a jasmine spec. -399 */ -400 var runs = function(func) { -401 jasmine.getEnv().currentSpec.runs(func); -402 }; -403 -404 /** -405 * Waits for a timeout before moving to the next runs()-defined block. -406 * @param {Number} timeout -407 */ -408 var waits = function(timeout) { -409 jasmine.getEnv().currentSpec.waits(timeout); -410 }; -411 -412 /** -413 * Waits for the latchFunction to return true before proceeding to the next runs()-defined block. -414 * -415 * @param {Number} timeout -416 * @param {Function} latchFunction -417 * @param {String} message -418 */ -419 var waitsFor = function(timeout, latchFunction, message) { -420 jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message); -421 }; -422 -423 /** -424 * A function that is called before each spec in a suite. -425 * -426 * Used for spec setup, including validating assumptions. -427 * -428 * @param {Function} beforeEachFunction -429 */ -430 var beforeEach = function(beforeEachFunction) { -431 jasmine.getEnv().beforeEach(beforeEachFunction); -432 }; -433 -434 /** -435 * A function that is called after each spec in a suite. -436 * -437 * Used for restoring any state that is hijacked during spec execution. -438 * -439 * @param {Function} afterEachFunction -440 */ -441 var afterEach = function(afterEachFunction) { -442 jasmine.getEnv().afterEach(afterEachFunction); -443 }; -444 -445 /** -446 * Defines a suite of specifications. -447 * -448 * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared -449 * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization -450 * of setup in some tests. -451 * -452 * @example -453 * // TODO: a simple suite -454 * -455 * // TODO: a simple suite with a nested describe block -456 * -457 * @param {String} description A string, usually the class under test. -458 * @param {Function} specDefinitions function that defines several specs. -459 */ -460 var describe = function(description, specDefinitions) { -461 return jasmine.getEnv().describe(description, specDefinitions); -462 }; -463 -464 /** -465 * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. -466 * -467 * @param {String} description A string, usually the class under test. -468 * @param {Function} specDefinitions function that defines several specs. -469 */ -470 var xdescribe = function(description, specDefinitions) { -471 return jasmine.getEnv().xdescribe(description, specDefinitions); -472 }; +291 jasmine.createSpy = function(name) { +292 +293 var spyObj = function() { +294 spyObj.wasCalled = true; +295 spyObj.callCount++; +296 var args = jasmine.util.argsToArray(arguments); +297 spyObj.mostRecentCall.object = this; +298 spyObj.mostRecentCall.args = args; +299 spyObj.argsForCall.push(args); +300 spyObj.calls.push({object: this, args: args}); +301 return spyObj.plan.apply(this, arguments); +302 }; +303 +304 var spy = new jasmine.Spy(name); +305 +306 for(var prop in spy) { +307 spyObj[prop] = spy[prop]; +308 } +309 +310 spyObj.reset(); +311 +312 return spyObj; +313 }; +314 +315 /** +316 * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something +317 * large in one call. +318 * +319 * @param {String} baseName name of spy class +320 * @param {Array} methodNames array of names of methods to make spies +321 */ +322 jasmine.createSpyObj = function(baseName, methodNames) { +323 var obj = {}; +324 for (var i = 0; i < methodNames.length; i++) { +325 obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); +326 } +327 return obj; +328 }; +329 +330 jasmine.log = function(message) { +331 jasmine.getEnv().currentSpec.log(message); +332 }; +333 +334 /** +335 * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. +336 * +337 * @example +338 * // spy example +339 * var foo = { +340 * not: function(bool) { return !bool; } +341 * } +342 * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops +343 * +344 * @see jasmine.createSpy +345 * @param obj +346 * @param methodName +347 * @returns a Jasmine spy that can be chained with all spy methods +348 */ +349 var spyOn = function(obj, methodName) { +350 return jasmine.getEnv().currentSpec.spyOn(obj, methodName); +351 }; +352 +353 /** +354 * Creates a Jasmine spec that will be added to the current suite. +355 * +356 * // TODO: pending tests +357 * +358 * @example +359 * it('should be true', function() { +360 * expect(true).toEqual(true); +361 * }); +362 * +363 * @param {String} desc description of this specification +364 * @param {Function} func defines the preconditions and expectations of the spec +365 */ +366 var it = function(desc, func) { +367 return jasmine.getEnv().it(desc, func); +368 }; +369 +370 /** +371 * Creates a <em>disabled</em> Jasmine spec. +372 * +373 * A convenience method that allows existing specs to be disabled temporarily during development. +374 * +375 * @param {String} desc description of this specification +376 * @param {Function} func defines the preconditions and expectations of the spec +377 */ +378 var xit = function(desc, func) { +379 return jasmine.getEnv().xit(desc, func); +380 }; +381 +382 /** +383 * Starts a chain for a Jasmine expectation. +384 * +385 * It is passed an Object that is the actual value and should chain to one of the many +386 * jasmine.Matchers functions. +387 * +388 * @param {Object} actual Actual value to test against and expected value +389 */ +390 var expect = function(actual) { +391 return jasmine.getEnv().currentSpec.expect(actual); +392 }; +393 +394 /** +395 * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. +396 * +397 * @param {Function} func Function that defines part of a jasmine spec. +398 */ +399 var runs = function(func) { +400 jasmine.getEnv().currentSpec.runs(func); +401 }; +402 +403 /** +404 * Waits for a timeout before moving to the next runs()-defined block. +405 * @param {Number} timeout +406 */ +407 var waits = function(timeout) { +408 jasmine.getEnv().currentSpec.waits(timeout); +409 }; +410 +411 /** +412 * Waits for the latchFunction to return true before proceeding to the next runs()-defined block. +413 * +414 * @param {Number} timeout +415 * @param {Function} latchFunction +416 * @param {String} message +417 */ +418 var waitsFor = function(timeout, latchFunction, message) { +419 jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message); +420 }; +421 +422 /** +423 * A function that is called before each spec in a suite. +424 * +425 * Used for spec setup, including validating assumptions. +426 * +427 * @param {Function} beforeEachFunction +428 */ +429 var beforeEach = function(beforeEachFunction) { +430 jasmine.getEnv().beforeEach(beforeEachFunction); +431 }; +432 +433 /** +434 * A function that is called after each spec in a suite. +435 * +436 * Used for restoring any state that is hijacked during spec execution. +437 * +438 * @param {Function} afterEachFunction +439 */ +440 var afterEach = function(afterEachFunction) { +441 jasmine.getEnv().afterEach(afterEachFunction); +442 }; +443 +444 /** +445 * Defines a suite of specifications. +446 * +447 * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared +448 * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization +449 * of setup in some tests. +450 * +451 * @example +452 * // TODO: a simple suite +453 * +454 * // TODO: a simple suite with a nested describe block +455 * +456 * @param {String} description A string, usually the class under test. +457 * @param {Function} specDefinitions function that defines several specs. +458 */ +459 var describe = function(description, specDefinitions) { +460 return jasmine.getEnv().describe(description, specDefinitions); +461 }; +462 +463 /** +464 * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. +465 * +466 * @param {String} description A string, usually the class under test. +467 * @param {Function} specDefinitions function that defines several specs. +468 */ +469 var xdescribe = function(description, specDefinitions) { +470 return jasmine.getEnv().xdescribe(description, specDefinitions); +471 }; +472 473 -474 -475 jasmine.XmlHttpRequest = XMLHttpRequest; -476 -477 // Provide the XMLHttpRequest class for IE 5.x-6.x: -478 if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() { -479 try { -480 return new ActiveXObject("Msxml2.XMLHTTP.6.0"); -481 } catch(e) { -482 } -483 try { -484 return new ActiveXObject("Msxml2.XMLHTTP.3.0"); -485 } catch(e) { -486 } -487 try { -488 return new ActiveXObject("Msxml2.XMLHTTP"); -489 } catch(e) { -490 } -491 try { -492 return new ActiveXObject("Microsoft.XMLHTTP"); -493 } catch(e) { -494 } -495 throw new Error("This browser does not support XMLHttpRequest."); -496 }; -497 -498 /** -499 * Adds suite files to an HTML document so that they are executed, thus adding them to the current -500 * Jasmine environment. -501 * -502 * @param {String} url path to the file to include -503 * @param {Boolean} opt_global -504 */ -505 jasmine.include = function(url, opt_global) { -506 if (opt_global) { -507 document.write('<script type="text/javascript" src="' + url + '"></' + 'script>'); -508 } else { -509 var xhr; -510 try { -511 xhr = new jasmine.XmlHttpRequest(); -512 xhr.open("GET", url, false); -513 xhr.send(null); -514 } catch(e) { -515 throw new Error("couldn't fetch " + url + ": " + e); -516 } -517 -518 return eval(xhr.responseText); -519 } -520 }; -521 -522 jasmine.version_= { -523 "major": 0, -524 "minor": 9, -525 "build": 0, -526 "revision": 1255468384 -527 }; -528 /** -529 * @namespace -530 */ -531 jasmine.util = {}; -532 -533 /** -534 * Declare that a child class inherite it's prototype from the parent class. -535 * -536 * @private -537 * @param {Function} childClass -538 * @param {Function} parentClass -539 */ -540 jasmine.util.inherit = function(childClass, parentClass) { -541 var subclass = function() { -542 }; -543 subclass.prototype = parentClass.prototype; -544 childClass.prototype = new subclass; -545 }; -546 -547 jasmine.util.formatException = function(e) { -548 var lineNumber; -549 if (e.line) { -550 lineNumber = e.line; -551 } -552 else if (e.lineNumber) { -553 lineNumber = e.lineNumber; -554 } -555 -556 var file; -557 -558 if (e.sourceURL) { -559 file = e.sourceURL; -560 } -561 else if (e.fileName) { -562 file = e.fileName; -563 } -564 -565 var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); -566 -567 if (file && lineNumber) { -568 message += ' in ' + file + ' (line ' + lineNumber + ')'; -569 } -570 -571 return message; -572 }; -573 -574 jasmine.util.htmlEscape = function(str) { -575 if (!str) return str; -576 return str.replace(/&/g, '&') -577 .replace(/</g, '<') -578 .replace(/>/g, '>'); -579 }; -580 -581 jasmine.util.argsToArray = function(args) { -582 var arrayOfArgs = []; -583 for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); -584 return arrayOfArgs; -585 }; -586 -587 /** -588 * Environment for Jasmine -589 * -590 * @constructor -591 */ -592 jasmine.Env = function() { -593 this.currentSpec = null; -594 this.currentSuite = null; -595 this.currentRunner_ = new jasmine.Runner(this); -596 this.currentlyRunningTests = false; -597 -598 this.reporter = new jasmine.MultiReporter(); -599 -600 this.updateInterval = jasmine.UPDATE_INTERVAL -601 this.lastUpdate = 0; -602 this.specFilter = function() { -603 return true; -604 }; -605 -606 this.nextSpecId_ = 0; -607 this.nextSuiteId_ = 0; -608 this.equalityTesters_ = []; -609 }; +474 jasmine.XmlHttpRequest = XMLHttpRequest; +475 +476 // Provide the XMLHttpRequest class for IE 5.x-6.x: +477 if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() { +478 try { +479 return new ActiveXObject("Msxml2.XMLHTTP.6.0"); +480 } catch(e) { +481 } +482 try { +483 return new ActiveXObject("Msxml2.XMLHTTP.3.0"); +484 } catch(e) { +485 } +486 try { +487 return new ActiveXObject("Msxml2.XMLHTTP"); +488 } catch(e) { +489 } +490 try { +491 return new ActiveXObject("Microsoft.XMLHTTP"); +492 } catch(e) { +493 } +494 throw new Error("This browser does not support XMLHttpRequest."); +495 }; +496 +497 /** +498 * Adds suite files to an HTML document so that they are executed, thus adding them to the current +499 * Jasmine environment. +500 * +501 * @param {String} url path to the file to include +502 * @param {Boolean} opt_global +503 */ +504 jasmine.include = function(url, opt_global) { +505 if (opt_global) { +506 document.write('<script type="text/javascript" src="' + url + '"></' + 'script>'); +507 } else { +508 var xhr; +509 try { +510 xhr = new jasmine.XmlHttpRequest(); +511 xhr.open("GET", url, false); +512 xhr.send(null); +513 } catch(e) { +514 throw new Error("couldn't fetch " + url + ": " + e); +515 } +516 +517 return eval(xhr.responseText); +518 } +519 }; +520 +521 jasmine.version_= { +522 "major": 0, +523 "minor": 9, +524 "build": 0, +525 "revision": 1255469309 +526 }; +527 /** +528 * @namespace +529 */ +530 jasmine.util = {}; +531 +532 /** +533 * Declare that a child class inherite it's prototype from the parent class. +534 * +535 * @private +536 * @param {Function} childClass +537 * @param {Function} parentClass +538 */ +539 jasmine.util.inherit = function(childClass, parentClass) { +540 var subclass = function() { +541 }; +542 subclass.prototype = parentClass.prototype; +543 childClass.prototype = new subclass; +544 }; +545 +546 jasmine.util.formatException = function(e) { +547 var lineNumber; +548 if (e.line) { +549 lineNumber = e.line; +550 } +551 else if (e.lineNumber) { +552 lineNumber = e.lineNumber; +553 } +554 +555 var file; +556 +557 if (e.sourceURL) { +558 file = e.sourceURL; +559 } +560 else if (e.fileName) { +561 file = e.fileName; +562 } +563 +564 var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); +565 +566 if (file && lineNumber) { +567 message += ' in ' + file + ' (line ' + lineNumber + ')'; +568 } +569 +570 return message; +571 }; +572 +573 jasmine.util.htmlEscape = function(str) { +574 if (!str) return str; +575 return str.replace(/&/g, '&') +576 .replace(/</g, '<') +577 .replace(/>/g, '>'); +578 }; +579 +580 jasmine.util.argsToArray = function(args) { +581 var arrayOfArgs = []; +582 for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); +583 return arrayOfArgs; +584 }; +585 +586 /** +587 * Environment for Jasmine +588 * +589 * @constructor +590 */ +591 jasmine.Env = function() { +592 this.currentSpec = null; +593 this.currentSuite = null; +594 this.currentRunner_ = new jasmine.Runner(this); +595 this.currentlyRunningTests = false; +596 +597 this.reporter = new jasmine.MultiReporter(); +598 +599 this.updateInterval = jasmine.UPDATE_INTERVAL +600 this.lastUpdate = 0; +601 this.specFilter = function() { +602 return true; +603 }; +604 +605 this.nextSpecId_ = 0; +606 this.nextSuiteId_ = 0; +607 this.equalityTesters_ = []; +608 }; +609 610 -611 -612 jasmine.Env.prototype.setTimeout = jasmine.setTimeout; -613 jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; -614 jasmine.Env.prototype.setInterval = jasmine.setInterval; -615 jasmine.Env.prototype.clearInterval = jasmine.clearInterval; -616 -617 /** -618 * @returns an object containing jasmine version build info, if set. -619 */ -620 jasmine.Env.prototype.version = function () { -621 if (jasmine.version_) { -622 return jasmine.version_; -623 } else { -624 throw new Error('Version not set'); -625 } -626 }; -627 -628 /** -629 * @returns a sequential integer starting at 0 -630 */ -631 jasmine.Env.prototype.nextSpecId = function () { -632 return this.nextSpecId_++; -633 }; -634 -635 /** -636 * @returns a sequential integer starting at 0 -637 */ -638 jasmine.Env.prototype.nextSuiteId = function () { -639 return this.nextSuiteId_++; -640 }; -641 -642 /** -643 * Register a reporter to receive status updates from Jasmine. -644 * @param {jasmine.Reporter} reporter An object which will receive status updates. -645 */ -646 jasmine.Env.prototype.addReporter = function(reporter) { -647 this.reporter.addReporter(reporter); -648 }; -649 -650 jasmine.Env.prototype.execute = function() { -651 this.currentRunner_.execute(); -652 }; -653 -654 jasmine.Env.prototype.describe = function(description, specDefinitions) { -655 var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); -656 -657 var parentSuite = this.currentSuite; -658 if (parentSuite) { -659 parentSuite.add(suite); -660 } else { -661 this.currentRunner_.add(suite); -662 } -663 -664 this.currentSuite = suite; -665 -666 specDefinitions.call(suite); -667 -668 this.currentSuite = parentSuite; -669 -670 return suite; -671 }; -672 -673 jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { -674 if (this.currentSuite) { -675 this.currentSuite.beforeEach(beforeEachFunction); -676 } else { -677 this.currentRunner_.beforeEach(beforeEachFunction); -678 } -679 }; -680 -681 jasmine.Env.prototype.currentRunner = function () { -682 return this.currentRunner_; -683 }; -684 -685 jasmine.Env.prototype.afterEach = function(afterEachFunction) { -686 if (this.currentSuite) { -687 this.currentSuite.afterEach(afterEachFunction); -688 } else { -689 this.currentRunner_.afterEach(afterEachFunction); -690 } -691 -692 }; -693 -694 jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { -695 return { -696 execute: function() { -697 } -698 }; -699 }; -700 -701 jasmine.Env.prototype.it = function(description, func) { -702 var spec = new jasmine.Spec(this, this.currentSuite, description); -703 this.currentSuite.add(spec); -704 this.currentSpec = spec; -705 -706 if (func) { -707 spec.runs(func); -708 } -709 -710 return spec; -711 }; -712 -713 jasmine.Env.prototype.xit = function(desc, func) { -714 return { -715 id: this.nextSpecId(), -716 runs: function() { -717 } -718 }; -719 }; -720 -721 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { -722 if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { -723 return true; -724 } -725 -726 a.__Jasmine_been_here_before__ = b; -727 b.__Jasmine_been_here_before__ = a; -728 -729 var hasKey = function(obj, keyName) { -730 return obj != null && obj[keyName] !== undefined; -731 }; -732 -733 for (var property in b) { -734 if (!hasKey(a, property) && hasKey(b, property)) { -735 mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>."); -736 } -737 } -738 for (property in a) { -739 if (!hasKey(b, property) && hasKey(a, property)) { -740 mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual."); -741 } -742 } -743 for (property in b) { -744 if (property == '__Jasmine_been_here_before__') continue; -745 if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { -746 mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />"); -747 } -748 } -749 -750 if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { -751 mismatchValues.push("arrays were not the same length"); -752 } -753 -754 delete a.__Jasmine_been_here_before__; -755 delete b.__Jasmine_been_here_before__; -756 return (mismatchKeys.length == 0 && mismatchValues.length == 0); -757 }; -758 -759 jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { -760 mismatchKeys = mismatchKeys || []; -761 mismatchValues = mismatchValues || []; -762 -763 if (a === b) return true; -764 -765 if (a === undefined || a === null || b === undefined || b === null) { -766 return (a == undefined && b == undefined); -767 } -768 -769 if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { -770 return a === b; -771 } -772 -773 if (a instanceof Date && b instanceof Date) { -774 return a.getTime() == b.getTime(); -775 } -776 -777 if (a instanceof jasmine.Matchers.Any) { -778 return a.matches(b); -779 } -780 -781 if (b instanceof jasmine.Matchers.Any) { -782 return b.matches(a); -783 } -784 -785 if (typeof a === "object" && typeof b === "object") { -786 return this.compareObjects_(a, b, mismatchKeys, mismatchValues); -787 } -788 -789 for (var i = 0; i < this.equalityTesters_.length; i++) { -790 var equalityTester = this.equalityTesters_[i]; -791 var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); -792 if (result !== undefined) return result; -793 } -794 -795 //Straight check -796 return (a === b); -797 }; -798 -799 jasmine.Env.prototype.contains_ = function(haystack, needle) { -800 if (jasmine.isArray_(haystack)) { -801 for (var i = 0; i < haystack.length; i++) { -802 if (this.equals_(haystack[i], needle)) return true; -803 } -804 return false; -805 } -806 return haystack.indexOf(needle) >= 0; -807 }; -808 -809 jasmine.Env.prototype.addEqualityTester = function(equalityTester) { -810 this.equalityTesters_.push(equalityTester); -811 }; -812 /** No-op base class for Jasmine reporters. -813 * -814 * @constructor -815 */ -816 jasmine.Reporter = function() { -817 }; -818 -819 //noinspection JSUnusedLocalSymbols -820 jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { -821 }; -822 -823 //noinspection JSUnusedLocalSymbols -824 jasmine.Reporter.prototype.reportRunnerResults = function(runner) { -825 }; -826 -827 //noinspection JSUnusedLocalSymbols -828 jasmine.Reporter.prototype.reportSuiteResults = function(suite) { -829 }; -830 -831 //noinspection JSUnusedLocalSymbols -832 jasmine.Reporter.prototype.reportSpecResults = function(spec) { -833 }; -834 -835 //noinspection JSUnusedLocalSymbols -836 jasmine.Reporter.prototype.log = function(str) { -837 }; -838 -839 /** -840 * Blocks are functions with executable code that make up a spec. -841 * -842 * @constructor -843 * @param {jasmine.Env} env -844 * @param {Function} func -845 * @param {jasmine.Spec} spec -846 */ -847 jasmine.Block = function(env, func, spec) { -848 this.env = env; -849 this.func = func; -850 this.spec = spec; -851 }; -852 -853 jasmine.Block.prototype.execute = function(onComplete) { -854 try { -855 this.func.apply(this.spec); -856 } catch (e) { -857 this.spec.fail(e); -858 } -859 onComplete(); -860 }; -861 /** JavaScript API reporter. -862 * -863 * @constructor -864 */ -865 jasmine.JsApiReporter = function() { -866 this.started = false; -867 this.finished = false; -868 this.suites_ = []; -869 this.results_ = {}; -870 }; -871 -872 jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { -873 this.started = true; -874 var suites = runner.suites(); -875 for (var i = 0; i < suites.length; i++) { -876 var suite = suites[i]; -877 this.suites_.push(this.summarize_(suite)); -878 } -879 }; -880 -881 jasmine.JsApiReporter.prototype.suites = function() { -882 return this.suites_; -883 }; -884 -885 jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { -886 var isSuite = suiteOrSpec instanceof jasmine.Suite -887 var summary = { -888 id: suiteOrSpec.id, -889 name: suiteOrSpec.description, -890 type: isSuite ? 'suite' : 'spec', -891 children: [] -892 }; -893 if (isSuite) { -894 var specs = suiteOrSpec.specs(); -895 for (var i = 0; i < specs.length; i++) { -896 summary.children.push(this.summarize_(specs[i])); -897 } -898 } -899 return summary; -900 }; -901 -902 jasmine.JsApiReporter.prototype.results = function() { -903 return this.results_; -904 }; -905 -906 jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { -907 return this.results_[specId]; -908 }; -909 -910 //noinspection JSUnusedLocalSymbols -911 jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { -912 this.finished = true; -913 }; -914 -915 //noinspection JSUnusedLocalSymbols -916 jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { -917 }; -918 -919 //noinspection JSUnusedLocalSymbols -920 jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { -921 this.results_[spec.id] = { -922 messages: spec.results().getItems(), -923 result: spec.results().failedCount > 0 ? "failed" : "passed" -924 }; -925 }; -926 -927 //noinspection JSUnusedLocalSymbols -928 jasmine.JsApiReporter.prototype.log = function(str) { -929 }; -930 -931 jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ -932 var results = {}; -933 for (var i = 0; i < specIds.length; i++) { -934 var specId = specIds[i]; -935 results[specId] = this.summarizeResult_(this.results_[specId]); -936 } -937 return results; -938 }; -939 -940 jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ -941 var summaryMessages = []; -942 for (var messageIndex in result.messages) { -943 var resultMessage = result.messages[messageIndex]; -944 summaryMessages.push({ -945 text: resultMessage.text, -946 passed: resultMessage.passed ? resultMessage.passed() : true, -947 type: resultMessage.type, -948 message: resultMessage.message, -949 trace: { -950 stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined -951 } -952 }); -953 }; -954 -955 var summaryResult = { -956 result : result.result, -957 messages : summaryMessages -958 }; -959 -960 return summaryResult; -961 }; -962 -963 jasmine.Matchers = function(env, actual, results) { -964 this.env = env; -965 this.actual = actual; -966 this.passing_message = 'Passed.'; -967 this.results_ = results || new jasmine.NestedResults(); -968 }; -969 -970 jasmine.Matchers.pp = function(str) { -971 return jasmine.util.htmlEscape(jasmine.pp(str)); -972 }; -973 -974 /** @deprecated */ -975 jasmine.Matchers.prototype.getResults = function() { -976 return this.results_; -977 }; -978 -979 jasmine.Matchers.prototype.results = function() { -980 return this.results_; -981 }; -982 -983 jasmine.Matchers.prototype.report = function(result, failing_message, details) { -984 this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details)); -985 return result; -986 }; -987 -988 /** -989 * Matcher that compares the actual to the expected using ===. -990 * -991 * @param expected -992 */ -993 jasmine.Matchers.prototype.toBe = function(expected) { -994 return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected) -995 + '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual) -996 + '<br />'); -997 }; -998 -999 /** -1000 * Matcher that compares the actual to the expected using !== -1001 * @param expected -1002 */ -1003 jasmine.Matchers.prototype.toNotBe = function(expected) { -1004 return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected) -1005 + '<br /><br />to be a different object from actual, but they were the same.'); -1006 }; -1007 -1008 /** -1009 * Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. -1010 * -1011 * @param expected -1012 */ -1013 jasmine.Matchers.prototype.toEqual = function(expected) { -1014 var mismatchKeys = []; -1015 var mismatchValues = []; -1016 -1017 var formatMismatches = function(name, array) { -1018 if (array.length == 0) return ''; -1019 var errorOutput = '<br /><br />Different ' + name + ':<br />'; -1020 for (var i = 0; i < array.length; i++) { -1021 errorOutput += array[i] + '<br />'; -1022 } -1023 return errorOutput; -1024 }; -1025 -1026 return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues), -1027 'Expected<br /><br />' + jasmine.Matchers.pp(expected) -1028 + '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual) -1029 + '<br />' -1030 + formatMismatches('Keys', mismatchKeys) -1031 + formatMismatches('Values', mismatchValues), { -1032 matcherName: 'toEqual', expected: expected, actual: this.actual -1033 }); -1034 }; -1035 /** @deprecated */ -1036 jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual; -1037 -1038 /** -1039 * Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual -1040 * @param expected -1041 */ -1042 jasmine.Matchers.prototype.toNotEqual = function(expected) { -1043 return this.report(!this.env.equals_(this.actual, expected), -1044 'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.'); -1045 }; -1046 /** @deprecated */ -1047 jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual; -1048 -1049 /** -1050 * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes -1051 * a pattern or a String. -1052 * -1053 * @param reg_exp -1054 */ -1055 jasmine.Matchers.prototype.toMatch = function(reg_exp) { -1056 return this.report((new RegExp(reg_exp).test(this.actual)), -1057 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.'); -1058 }; -1059 /** @deprecated */ -1060 jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch; -1061 -1062 /** -1063 * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch -1064 * @param reg_exp -1065 */ -1066 jasmine.Matchers.prototype.toNotMatch = function(reg_exp) { -1067 return this.report((!new RegExp(reg_exp).test(this.actual)), -1068 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.'); -1069 }; -1070 /** @deprecated */ -1071 jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch; -1072 -1073 /** -1074 * Matcher that compares the acutal to undefined. -1075 */ -1076 jasmine.Matchers.prototype.toBeDefined = function() { -1077 return this.report((this.actual !== undefined), -1078 'Expected a value to be defined but it was undefined.'); -1079 }; -1080 /** @deprecated */ -1081 jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined; -1082 -1083 /** -1084 * Matcher that compares the actual to null. -1085 * -1086 */ -1087 jasmine.Matchers.prototype.toBeNull = function() { -1088 return this.report((this.actual === null), -1089 'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.'); -1090 }; -1091 /** @deprecated */ -1092 jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull; -1093 -1094 /** -1095 * Matcher that boolean not-nots the actual. -1096 */ -1097 jasmine.Matchers.prototype.toBeTruthy = function() { -1098 return this.report(!!this.actual, -1099 'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.'); -1100 }; -1101 /** @deprecated */ -1102 jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy; -1103 -1104 /** -1105 * Matcher that boolean nots the actual. -1106 */ -1107 jasmine.Matchers.prototype.toBeFalsy = function() { -1108 return this.report(!this.actual, -1109 'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.'); -1110 }; -1111 /** @deprecated */ -1112 jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy; -1113 -1114 /** -1115 * Matcher that checks to see if the acutal, a Jasmine spy, was called. -1116 */ -1117 jasmine.Matchers.prototype.wasCalled = function() { -1118 if (!this.actual || !this.actual.isSpy) { -1119 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); -1120 } -1121 if (arguments.length > 0) { -1122 return this.report(false, 'wasCalled matcher does not take arguments'); -1123 } -1124 return this.report((this.actual.wasCalled), -1125 'Expected spy "' + this.actual.identity + '" to have been called, but it was not.'); -1126 }; -1127 /** @deprecated */ -1128 jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled; -1129 -1130 /** -1131 * Matcher that checks to see if the acutal, a Jasmine spy, was not called. -1132 */ -1133 jasmine.Matchers.prototype.wasNotCalled = function() { -1134 if (!this.actual || !this.actual.isSpy) { -1135 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); -1136 } -1137 return this.report((!this.actual.wasCalled), -1138 'Expected spy "' + this.actual.identity + '" to not have been called, but it was.'); -1139 }; -1140 /** @deprecated */ -1141 jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled; -1142 -1143 /** -1144 * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters. -1145 * -1146 * @example -1147 * -1148 */ -1149 jasmine.Matchers.prototype.wasCalledWith = function() { -1150 if (!this.actual || !this.actual.isSpy) { -1151 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', { -1152 matcherName: 'wasCalledWith' -1153 }); -1154 } -1155 -1156 var args = jasmine.util.argsToArray(arguments); -1157 -1158 return this.report(this.env.contains_(this.actual.argsForCall, args), -1159 'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', { -1160 matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall -1161 }); -1162 }; -1163 -1164 /** -1165 * Matcher that checks that the expected item is an element in the actual Array. -1166 * -1167 * @param {Object} item -1168 */ -1169 jasmine.Matchers.prototype.toContain = function(item) { -1170 return this.report(this.env.contains_(this.actual, item), -1171 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', { -1172 matcherName: 'toContain', expected: item, actual: this.actual -1173 }); -1174 }; -1175 -1176 /** -1177 * Matcher that checks that the expected item is NOT an element in the actual Array. -1178 * -1179 * @param {Object} item -1180 */ -1181 jasmine.Matchers.prototype.toNotContain = function(item) { -1182 return this.report(!this.env.contains_(this.actual, item), -1183 'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.'); -1184 }; -1185 -1186 jasmine.Matchers.prototype.toBeLessThan = function(expected) { -1187 return this.report(this.actual < expected, -1188 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -1189 }; -1190 -1191 jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { -1192 return this.report(this.actual > expected, -1193 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -1194 }; -1195 -1196 /** -1197 * Matcher that checks that the expected exception was thrown by the actual. -1198 * -1199 * @param {String} expectedException -1200 */ -1201 jasmine.Matchers.prototype.toThrow = function(expectedException) { -1202 var exception = null; -1203 try { -1204 this.actual(); -1205 } catch (e) { -1206 exception = e; -1207 } -1208 if (expectedException !== undefined) { -1209 if (exception == null) { -1210 return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not."); -1211 } -1212 return this.report( -1213 this.env.equals_( -1214 exception.message || exception, -1215 expectedException.message || expectedException), -1216 "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + "."); -1217 } else { -1218 return this.report(exception != null, "Expected function to throw an exception, but it did not."); -1219 } -1220 }; -1221 -1222 jasmine.Matchers.Any = function(expectedClass) { -1223 this.expectedClass = expectedClass; -1224 }; -1225 -1226 jasmine.Matchers.Any.prototype.matches = function(other) { -1227 if (this.expectedClass == String) { -1228 return typeof other == 'string' || other instanceof String; -1229 } -1230 -1231 if (this.expectedClass == Number) { -1232 return typeof other == 'number' || other instanceof Number; -1233 } -1234 -1235 if (this.expectedClass == Function) { -1236 return typeof other == 'function' || other instanceof Function; -1237 } -1238 -1239 if (this.expectedClass == Object) { -1240 return typeof other == 'object'; -1241 } -1242 -1243 return other instanceof this.expectedClass; -1244 }; -1245 -1246 jasmine.Matchers.Any.prototype.toString = function() { -1247 return '<jasmine.any(' + this.expectedClass + ')>'; -1248 }; -1249 -1250 /** -1251 * @constructor -1252 */ -1253 jasmine.MultiReporter = function() { -1254 this.subReporters_ = []; -1255 }; -1256 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); -1257 -1258 jasmine.MultiReporter.prototype.addReporter = function(reporter) { -1259 this.subReporters_.push(reporter); -1260 }; -1261 -1262 (function() { -1263 var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"]; -1264 for (var i = 0; i < functionNames.length; i++) { -1265 var functionName = functionNames[i]; -1266 jasmine.MultiReporter.prototype[functionName] = (function(functionName) { -1267 return function() { -1268 for (var j = 0; j < this.subReporters_.length; j++) { -1269 var subReporter = this.subReporters_[j]; -1270 if (subReporter[functionName]) { -1271 subReporter[functionName].apply(subReporter, arguments); -1272 } -1273 } -1274 }; -1275 })(functionName); -1276 } -1277 })(); -1278 /** -1279 * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults -1280 * -1281 * @constructor -1282 */ -1283 jasmine.NestedResults = function() { -1284 /** -1285 * The total count of results -1286 */ -1287 this.totalCount = 0; -1288 /** -1289 * Number of passed results -1290 */ -1291 this.passedCount = 0; -1292 /** -1293 * Number of failed results -1294 */ -1295 this.failedCount = 0; -1296 /** -1297 * Was this suite/spec skipped? -1298 */ -1299 this.skipped = false; -1300 /** -1301 * @ignore -1302 */ -1303 this.items_ = []; -1304 }; -1305 -1306 /** -1307 * Roll up the result counts. -1308 * -1309 * @param result -1310 */ -1311 jasmine.NestedResults.prototype.rollupCounts = function(result) { -1312 this.totalCount += result.totalCount; -1313 this.passedCount += result.passedCount; -1314 this.failedCount += result.failedCount; -1315 }; -1316 -1317 /** -1318 * Tracks a result's message. -1319 * @param message -1320 */ -1321 jasmine.NestedResults.prototype.log = function(message) { -1322 this.items_.push(new jasmine.MessageResult(message)); -1323 }; -1324 -1325 /** -1326 * Getter for the results: message & results. -1327 */ -1328 jasmine.NestedResults.prototype.getItems = function() { -1329 return this.items_; -1330 }; -1331 -1332 /** -1333 * Adds a result, tracking counts (total, passed, & failed) -1334 * @param {jasmine.ExpectationResult|jasmine.NestedResults} result -1335 */ -1336 jasmine.NestedResults.prototype.addResult = function(result) { -1337 if (result.type != 'MessageResult') { -1338 if (result.items_) { -1339 this.rollupCounts(result); -1340 } else { -1341 this.totalCount++; -1342 if (result.passed()) { -1343 this.passedCount++; -1344 } else { -1345 this.failedCount++; -1346 } -1347 } -1348 } -1349 this.items_.push(result); -1350 }; -1351 -1352 /** -1353 * @returns {Boolean} True if <b>everything</b> below passed -1354 */ -1355 jasmine.NestedResults.prototype.passed = function() { -1356 return this.passedCount === this.totalCount; -1357 }; -1358 /** -1359 * Base class for pretty printing for expectation results. -1360 */ -1361 jasmine.PrettyPrinter = function() { -1362 this.ppNestLevel_ = 0; -1363 }; -1364 -1365 /** -1366 * Formats a value in a nice, human-readable string. -1367 * -1368 * @param value -1369 * @returns {String} -1370 */ -1371 jasmine.PrettyPrinter.prototype.format = function(value) { -1372 if (this.ppNestLevel_ > 40) { -1373 // return '(jasmine.pp nested too deeply!)'; -1374 throw new Error('jasmine.PrettyPrinter: format() nested too deeply!'); -1375 } -1376 -1377 this.ppNestLevel_++; -1378 try { -1379 if (value === undefined) { -1380 this.emitScalar('undefined'); -1381 } else if (value === null) { -1382 this.emitScalar('null'); -1383 } else if (value.navigator && value.frames && value.setTimeout) { -1384 this.emitScalar('<window>'); -1385 } else if (value instanceof jasmine.Matchers.Any) { -1386 this.emitScalar(value.toString()); -1387 } else if (typeof value === 'string') { -1388 this.emitString(value); -1389 } else if (typeof value === 'function') { -1390 this.emitScalar('Function'); -1391 } else if (typeof value.nodeType === 'number') { -1392 this.emitScalar('HTMLNode'); -1393 } else if (value instanceof Date) { -1394 this.emitScalar('Date(' + value + ')'); -1395 } else if (value.__Jasmine_been_here_before__) { -1396 this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>'); -1397 } else if (jasmine.isArray_(value) || typeof value == 'object') { -1398 value.__Jasmine_been_here_before__ = true; -1399 if (jasmine.isArray_(value)) { -1400 this.emitArray(value); -1401 } else { -1402 this.emitObject(value); -1403 } -1404 delete value.__Jasmine_been_here_before__; -1405 } else { -1406 this.emitScalar(value.toString()); -1407 } -1408 } finally { -1409 this.ppNestLevel_--; -1410 } -1411 }; -1412 -1413 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { -1414 for (var property in obj) { -1415 if (property == '__Jasmine_been_here_before__') continue; -1416 fn(property, obj.__lookupGetter__(property) != null); -1417 } -1418 }; -1419 -1420 jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; -1421 jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; -1422 jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; -1423 jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; -1424 -1425 jasmine.StringPrettyPrinter = function() { -1426 jasmine.PrettyPrinter.call(this); -1427 -1428 this.string = ''; -1429 }; -1430 jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); -1431 -1432 jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { -1433 this.append(value); -1434 }; -1435 -1436 jasmine.StringPrettyPrinter.prototype.emitString = function(value) { -1437 this.append("'" + value + "'"); -1438 }; -1439 -1440 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { -1441 this.append('[ '); -1442 for (var i = 0; i < array.length; i++) { -1443 if (i > 0) { -1444 this.append(', '); -1445 } -1446 this.format(array[i]); -1447 } -1448 this.append(' ]'); -1449 }; -1450 -1451 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { -1452 var self = this; -1453 this.append('{ '); -1454 var first = true; -1455 -1456 this.iterateObject(obj, function(property, isGetter) { -1457 if (first) { -1458 first = false; -1459 } else { -1460 self.append(', '); -1461 } -1462 -1463 self.append(property); -1464 self.append(' : '); -1465 if (isGetter) { -1466 self.append('<getter>'); -1467 } else { -1468 self.format(obj[property]); -1469 } -1470 }); -1471 -1472 this.append(' }'); -1473 }; -1474 -1475 jasmine.StringPrettyPrinter.prototype.append = function(value) { -1476 this.string += value; -1477 }; -1478 jasmine.Queue = function(env) { -1479 this.env = env; -1480 this.blocks = []; -1481 this.running = false; -1482 this.index = 0; -1483 this.offset = 0; -1484 }; -1485 -1486 jasmine.Queue.prototype.addBefore = function(block) { -1487 this.blocks.unshift(block); -1488 }; -1489 -1490 jasmine.Queue.prototype.add = function(block) { -1491 this.blocks.push(block); -1492 }; -1493 -1494 jasmine.Queue.prototype.insertNext = function(block) { -1495 this.blocks.splice((this.index + this.offset + 1), 0, block); -1496 this.offset++; -1497 }; -1498 -1499 jasmine.Queue.prototype.start = function(onComplete) { -1500 this.running = true; -1501 this.onComplete = onComplete; -1502 this.next_(); -1503 }; -1504 -1505 jasmine.Queue.prototype.isRunning = function() { -1506 return this.running; -1507 }; -1508 -1509 jasmine.Queue.LOOP_DONT_RECURSE = true; -1510 -1511 jasmine.Queue.prototype.next_ = function() { -1512 var self = this; -1513 var goAgain = true; -1514 -1515 while (goAgain) { -1516 goAgain = false; -1517 -1518 if (self.index < self.blocks.length) { -1519 var calledSynchronously = true; -1520 var completedSynchronously = false; -1521 -1522 var onComplete = function () { -1523 if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { -1524 completedSynchronously = true; -1525 return; -1526 } -1527 -1528 self.offset = 0; -1529 self.index++; -1530 -1531 var now = new Date().getTime(); -1532 if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { -1533 self.env.lastUpdate = now; -1534 self.env.setTimeout(function() { -1535 self.next_(); -1536 }, 0); -1537 } else { -1538 if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { -1539 goAgain = true; -1540 } else { -1541 self.next_(); -1542 } -1543 } -1544 }; -1545 self.blocks[self.index].execute(onComplete); -1546 -1547 calledSynchronously = false; -1548 if (completedSynchronously) { -1549 onComplete(); -1550 } -1551 -1552 } else { -1553 self.running = false; -1554 if (self.onComplete) { -1555 self.onComplete(); -1556 } -1557 } -1558 } -1559 }; -1560 -1561 jasmine.Queue.prototype.results = function() { -1562 var results = new jasmine.NestedResults(); -1563 for (var i = 0; i < this.blocks.length; i++) { -1564 if (this.blocks[i].results) { -1565 results.addResult(this.blocks[i].results()); -1566 } -1567 } -1568 return results; -1569 }; +611 jasmine.Env.prototype.setTimeout = jasmine.setTimeout; +612 jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; +613 jasmine.Env.prototype.setInterval = jasmine.setInterval; +614 jasmine.Env.prototype.clearInterval = jasmine.clearInterval; +615 +616 /** +617 * @returns an object containing jasmine version build info, if set. +618 */ +619 jasmine.Env.prototype.version = function () { +620 if (jasmine.version_) { +621 return jasmine.version_; +622 } else { +623 throw new Error('Version not set'); +624 } +625 }; +626 +627 /** +628 * @returns a sequential integer starting at 0 +629 */ +630 jasmine.Env.prototype.nextSpecId = function () { +631 return this.nextSpecId_++; +632 }; +633 +634 /** +635 * @returns a sequential integer starting at 0 +636 */ +637 jasmine.Env.prototype.nextSuiteId = function () { +638 return this.nextSuiteId_++; +639 }; +640 +641 /** +642 * Register a reporter to receive status updates from Jasmine. +643 * @param {jasmine.Reporter} reporter An object which will receive status updates. +644 */ +645 jasmine.Env.prototype.addReporter = function(reporter) { +646 this.reporter.addReporter(reporter); +647 }; +648 +649 jasmine.Env.prototype.execute = function() { +650 this.currentRunner_.execute(); +651 }; +652 +653 jasmine.Env.prototype.describe = function(description, specDefinitions) { +654 var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); +655 +656 var parentSuite = this.currentSuite; +657 if (parentSuite) { +658 parentSuite.add(suite); +659 } else { +660 this.currentRunner_.add(suite); +661 } +662 +663 this.currentSuite = suite; +664 +665 specDefinitions.call(suite); +666 +667 this.currentSuite = parentSuite; +668 +669 return suite; +670 }; +671 +672 jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { +673 if (this.currentSuite) { +674 this.currentSuite.beforeEach(beforeEachFunction); +675 } else { +676 this.currentRunner_.beforeEach(beforeEachFunction); +677 } +678 }; +679 +680 jasmine.Env.prototype.currentRunner = function () { +681 return this.currentRunner_; +682 }; +683 +684 jasmine.Env.prototype.afterEach = function(afterEachFunction) { +685 if (this.currentSuite) { +686 this.currentSuite.afterEach(afterEachFunction); +687 } else { +688 this.currentRunner_.afterEach(afterEachFunction); +689 } +690 +691 }; +692 +693 jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { +694 return { +695 execute: function() { +696 } +697 }; +698 }; +699 +700 jasmine.Env.prototype.it = function(description, func) { +701 var spec = new jasmine.Spec(this, this.currentSuite, description); +702 this.currentSuite.add(spec); +703 this.currentSpec = spec; +704 +705 if (func) { +706 spec.runs(func); +707 } +708 +709 return spec; +710 }; +711 +712 jasmine.Env.prototype.xit = function(desc, func) { +713 return { +714 id: this.nextSpecId(), +715 runs: function() { +716 } +717 }; +718 }; +719 +720 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { +721 if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { +722 return true; +723 } +724 +725 a.__Jasmine_been_here_before__ = b; +726 b.__Jasmine_been_here_before__ = a; +727 +728 var hasKey = function(obj, keyName) { +729 return obj != null && obj[keyName] !== undefined; +730 }; +731 +732 for (var property in b) { +733 if (!hasKey(a, property) && hasKey(b, property)) { +734 mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>."); +735 } +736 } +737 for (property in a) { +738 if (!hasKey(b, property) && hasKey(a, property)) { +739 mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual."); +740 } +741 } +742 for (property in b) { +743 if (property == '__Jasmine_been_here_before__') continue; +744 if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { +745 mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />"); +746 } +747 } +748 +749 if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { +750 mismatchValues.push("arrays were not the same length"); +751 } +752 +753 delete a.__Jasmine_been_here_before__; +754 delete b.__Jasmine_been_here_before__; +755 return (mismatchKeys.length == 0 && mismatchValues.length == 0); +756 }; +757 +758 jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { +759 mismatchKeys = mismatchKeys || []; +760 mismatchValues = mismatchValues || []; +761 +762 if (a === b) return true; +763 +764 if (a === undefined || a === null || b === undefined || b === null) { +765 return (a == undefined && b == undefined); +766 } +767 +768 if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { +769 return a === b; +770 } +771 +772 if (a instanceof Date && b instanceof Date) { +773 return a.getTime() == b.getTime(); +774 } +775 +776 if (a instanceof jasmine.Matchers.Any) { +777 return a.matches(b); +778 } +779 +780 if (b instanceof jasmine.Matchers.Any) { +781 return b.matches(a); +782 } +783 +784 if (typeof a === "object" && typeof b === "object") { +785 return this.compareObjects_(a, b, mismatchKeys, mismatchValues); +786 } +787 +788 for (var i = 0; i < this.equalityTesters_.length; i++) { +789 var equalityTester = this.equalityTesters_[i]; +790 var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); +791 if (result !== undefined) return result; +792 } +793 +794 //Straight check +795 return (a === b); +796 }; +797 +798 jasmine.Env.prototype.contains_ = function(haystack, needle) { +799 if (jasmine.isArray_(haystack)) { +800 for (var i = 0; i < haystack.length; i++) { +801 if (this.equals_(haystack[i], needle)) return true; +802 } +803 return false; +804 } +805 return haystack.indexOf(needle) >= 0; +806 }; +807 +808 jasmine.Env.prototype.addEqualityTester = function(equalityTester) { +809 this.equalityTesters_.push(equalityTester); +810 }; +811 /** No-op base class for Jasmine reporters. +812 * +813 * @constructor +814 */ +815 jasmine.Reporter = function() { +816 }; +817 +818 //noinspection JSUnusedLocalSymbols +819 jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { +820 }; +821 +822 //noinspection JSUnusedLocalSymbols +823 jasmine.Reporter.prototype.reportRunnerResults = function(runner) { +824 }; +825 +826 //noinspection JSUnusedLocalSymbols +827 jasmine.Reporter.prototype.reportSuiteResults = function(suite) { +828 }; +829 +830 //noinspection JSUnusedLocalSymbols +831 jasmine.Reporter.prototype.reportSpecResults = function(spec) { +832 }; +833 +834 //noinspection JSUnusedLocalSymbols +835 jasmine.Reporter.prototype.log = function(str) { +836 }; +837 +838 /** +839 * Blocks are functions with executable code that make up a spec. +840 * +841 * @constructor +842 * @param {jasmine.Env} env +843 * @param {Function} func +844 * @param {jasmine.Spec} spec +845 */ +846 jasmine.Block = function(env, func, spec) { +847 this.env = env; +848 this.func = func; +849 this.spec = spec; +850 }; +851 +852 jasmine.Block.prototype.execute = function(onComplete) { +853 try { +854 this.func.apply(this.spec); +855 } catch (e) { +856 this.spec.fail(e); +857 } +858 onComplete(); +859 }; +860 /** JavaScript API reporter. +861 * +862 * @constructor +863 */ +864 jasmine.JsApiReporter = function() { +865 this.started = false; +866 this.finished = false; +867 this.suites_ = []; +868 this.results_ = {}; +869 }; +870 +871 jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { +872 this.started = true; +873 var suites = runner.suites(); +874 for (var i = 0; i < suites.length; i++) { +875 var suite = suites[i]; +876 this.suites_.push(this.summarize_(suite)); +877 } +878 }; +879 +880 jasmine.JsApiReporter.prototype.suites = function() { +881 return this.suites_; +882 }; +883 +884 jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { +885 var isSuite = suiteOrSpec instanceof jasmine.Suite +886 var summary = { +887 id: suiteOrSpec.id, +888 name: suiteOrSpec.description, +889 type: isSuite ? 'suite' : 'spec', +890 children: [] +891 }; +892 if (isSuite) { +893 var specs = suiteOrSpec.specs(); +894 for (var i = 0; i < specs.length; i++) { +895 summary.children.push(this.summarize_(specs[i])); +896 } +897 } +898 return summary; +899 }; +900 +901 jasmine.JsApiReporter.prototype.results = function() { +902 return this.results_; +903 }; +904 +905 jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { +906 return this.results_[specId]; +907 }; +908 +909 //noinspection JSUnusedLocalSymbols +910 jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { +911 this.finished = true; +912 }; +913 +914 //noinspection JSUnusedLocalSymbols +915 jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { +916 }; +917 +918 //noinspection JSUnusedLocalSymbols +919 jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { +920 this.results_[spec.id] = { +921 messages: spec.results().getItems(), +922 result: spec.results().failedCount > 0 ? "failed" : "passed" +923 }; +924 }; +925 +926 //noinspection JSUnusedLocalSymbols +927 jasmine.JsApiReporter.prototype.log = function(str) { +928 }; +929 +930 jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ +931 var results = {}; +932 for (var i = 0; i < specIds.length; i++) { +933 var specId = specIds[i]; +934 results[specId] = this.summarizeResult_(this.results_[specId]); +935 } +936 return results; +937 }; +938 +939 jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ +940 var summaryMessages = []; +941 for (var messageIndex in result.messages) { +942 var resultMessage = result.messages[messageIndex]; +943 summaryMessages.push({ +944 text: resultMessage.text, +945 passed: resultMessage.passed ? resultMessage.passed() : true, +946 type: resultMessage.type, +947 message: resultMessage.message, +948 trace: { +949 stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined +950 } +951 }); +952 }; +953 +954 var summaryResult = { +955 result : result.result, +956 messages : summaryMessages +957 }; +958 +959 return summaryResult; +960 }; +961 +962 jasmine.Matchers = function(env, actual, results) { +963 this.env = env; +964 this.actual = actual; +965 this.passing_message = 'Passed.'; +966 this.results_ = results || new jasmine.NestedResults(); +967 }; +968 +969 jasmine.Matchers.pp = function(str) { +970 return jasmine.util.htmlEscape(jasmine.pp(str)); +971 }; +972 +973 /** @deprecated */ +974 jasmine.Matchers.prototype.getResults = function() { +975 return this.results_; +976 }; +977 +978 jasmine.Matchers.prototype.results = function() { +979 return this.results_; +980 }; +981 +982 jasmine.Matchers.prototype.report = function(result, failing_message, details) { +983 this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details)); +984 return result; +985 }; +986 +987 /** +988 * Matcher that compares the actual to the expected using ===. +989 * +990 * @param expected +991 */ +992 jasmine.Matchers.prototype.toBe = function(expected) { +993 return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected) +994 + '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual) +995 + '<br />'); +996 }; +997 +998 /** +999 * Matcher that compares the actual to the expected using !== +1000 * @param expected +1001 */ +1002 jasmine.Matchers.prototype.toNotBe = function(expected) { +1003 return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected) +1004 + '<br /><br />to be a different object from actual, but they were the same.'); +1005 }; +1006 +1007 /** +1008 * Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. +1009 * +1010 * @param expected +1011 */ +1012 jasmine.Matchers.prototype.toEqual = function(expected) { +1013 var mismatchKeys = []; +1014 var mismatchValues = []; +1015 +1016 var formatMismatches = function(name, array) { +1017 if (array.length == 0) return ''; +1018 var errorOutput = '<br /><br />Different ' + name + ':<br />'; +1019 for (var i = 0; i < array.length; i++) { +1020 errorOutput += array[i] + '<br />'; +1021 } +1022 return errorOutput; +1023 }; +1024 +1025 return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues), +1026 'Expected<br /><br />' + jasmine.Matchers.pp(expected) +1027 + '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual) +1028 + '<br />' +1029 + formatMismatches('Keys', mismatchKeys) +1030 + formatMismatches('Values', mismatchValues), { +1031 matcherName: 'toEqual', expected: expected, actual: this.actual +1032 }); +1033 }; +1034 /** @deprecated */ +1035 jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual; +1036 +1037 /** +1038 * Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual +1039 * @param expected +1040 */ +1041 jasmine.Matchers.prototype.toNotEqual = function(expected) { +1042 return this.report(!this.env.equals_(this.actual, expected), +1043 'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.'); +1044 }; +1045 /** @deprecated */ +1046 jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual; +1047 +1048 /** +1049 * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes +1050 * a pattern or a String. +1051 * +1052 * @param reg_exp +1053 */ +1054 jasmine.Matchers.prototype.toMatch = function(reg_exp) { +1055 return this.report((new RegExp(reg_exp).test(this.actual)), +1056 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.'); +1057 }; +1058 /** @deprecated */ +1059 jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch; +1060 +1061 /** +1062 * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch +1063 * @param reg_exp +1064 */ +1065 jasmine.Matchers.prototype.toNotMatch = function(reg_exp) { +1066 return this.report((!new RegExp(reg_exp).test(this.actual)), +1067 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.'); +1068 }; +1069 /** @deprecated */ +1070 jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch; +1071 +1072 /** +1073 * Matcher that compares the acutal to undefined. +1074 */ +1075 jasmine.Matchers.prototype.toBeDefined = function() { +1076 return this.report((this.actual !== undefined), +1077 'Expected a value to be defined but it was undefined.'); +1078 }; +1079 /** @deprecated */ +1080 jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined; +1081 +1082 /** +1083 * Matcher that compares the actual to null. +1084 * +1085 */ +1086 jasmine.Matchers.prototype.toBeNull = function() { +1087 return this.report((this.actual === null), +1088 'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.'); +1089 }; +1090 /** @deprecated */ +1091 jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull; +1092 +1093 /** +1094 * Matcher that boolean not-nots the actual. +1095 */ +1096 jasmine.Matchers.prototype.toBeTruthy = function() { +1097 return this.report(!!this.actual, +1098 'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.'); +1099 }; +1100 /** @deprecated */ +1101 jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy; +1102 +1103 /** +1104 * Matcher that boolean nots the actual. +1105 */ +1106 jasmine.Matchers.prototype.toBeFalsy = function() { +1107 return this.report(!this.actual, +1108 'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.'); +1109 }; +1110 /** @deprecated */ +1111 jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy; +1112 +1113 /** +1114 * Matcher that checks to see if the acutal, a Jasmine spy, was called. +1115 */ +1116 jasmine.Matchers.prototype.wasCalled = function() { +1117 if (!this.actual || !this.actual.isSpy) { +1118 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); +1119 } +1120 if (arguments.length > 0) { +1121 return this.report(false, 'wasCalled matcher does not take arguments'); +1122 } +1123 return this.report((this.actual.wasCalled), +1124 'Expected spy "' + this.actual.identity + '" to have been called, but it was not.'); +1125 }; +1126 /** @deprecated */ +1127 jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled; +1128 +1129 /** +1130 * Matcher that checks to see if the acutal, a Jasmine spy, was not called. +1131 */ +1132 jasmine.Matchers.prototype.wasNotCalled = function() { +1133 if (!this.actual || !this.actual.isSpy) { +1134 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.'); +1135 } +1136 return this.report((!this.actual.wasCalled), +1137 'Expected spy "' + this.actual.identity + '" to not have been called, but it was.'); +1138 }; +1139 /** @deprecated */ +1140 jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled; +1141 +1142 /** +1143 * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters. +1144 * +1145 * @example +1146 * +1147 */ +1148 jasmine.Matchers.prototype.wasCalledWith = function() { +1149 if (!this.actual || !this.actual.isSpy) { +1150 return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', { +1151 matcherName: 'wasCalledWith' +1152 }); +1153 } +1154 +1155 var args = jasmine.util.argsToArray(arguments); +1156 +1157 return this.report(this.env.contains_(this.actual.argsForCall, args), +1158 'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', { +1159 matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall +1160 }); +1161 }; +1162 +1163 /** +1164 * Matcher that checks that the expected item is an element in the actual Array. +1165 * +1166 * @param {Object} item +1167 */ +1168 jasmine.Matchers.prototype.toContain = function(item) { +1169 return this.report(this.env.contains_(this.actual, item), +1170 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', { +1171 matcherName: 'toContain', expected: item, actual: this.actual +1172 }); +1173 }; +1174 +1175 /** +1176 * Matcher that checks that the expected item is NOT an element in the actual Array. +1177 * +1178 * @param {Object} item +1179 */ +1180 jasmine.Matchers.prototype.toNotContain = function(item) { +1181 return this.report(!this.env.contains_(this.actual, item), +1182 'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.'); +1183 }; +1184 +1185 jasmine.Matchers.prototype.toBeLessThan = function(expected) { +1186 return this.report(this.actual < expected, +1187 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +1188 }; +1189 +1190 jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { +1191 return this.report(this.actual > expected, +1192 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +1193 }; +1194 +1195 /** +1196 * Matcher that checks that the expected exception was thrown by the actual. +1197 * +1198 * @param {String} expectedException +1199 */ +1200 jasmine.Matchers.prototype.toThrow = function(expectedException) { +1201 var exception = null; +1202 try { +1203 this.actual(); +1204 } catch (e) { +1205 exception = e; +1206 } +1207 if (expectedException !== undefined) { +1208 if (exception == null) { +1209 return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not."); +1210 } +1211 return this.report( +1212 this.env.equals_( +1213 exception.message || exception, +1214 expectedException.message || expectedException), +1215 "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + "."); +1216 } else { +1217 return this.report(exception != null, "Expected function to throw an exception, but it did not."); +1218 } +1219 }; +1220 +1221 jasmine.Matchers.Any = function(expectedClass) { +1222 this.expectedClass = expectedClass; +1223 }; +1224 +1225 jasmine.Matchers.Any.prototype.matches = function(other) { +1226 if (this.expectedClass == String) { +1227 return typeof other == 'string' || other instanceof String; +1228 } +1229 +1230 if (this.expectedClass == Number) { +1231 return typeof other == 'number' || other instanceof Number; +1232 } +1233 +1234 if (this.expectedClass == Function) { +1235 return typeof other == 'function' || other instanceof Function; +1236 } +1237 +1238 if (this.expectedClass == Object) { +1239 return typeof other == 'object'; +1240 } +1241 +1242 return other instanceof this.expectedClass; +1243 }; +1244 +1245 jasmine.Matchers.Any.prototype.toString = function() { +1246 return '<jasmine.any(' + this.expectedClass + ')>'; +1247 }; +1248 +1249 /** +1250 * @constructor +1251 */ +1252 jasmine.MultiReporter = function() { +1253 this.subReporters_ = []; +1254 }; +1255 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); +1256 +1257 jasmine.MultiReporter.prototype.addReporter = function(reporter) { +1258 this.subReporters_.push(reporter); +1259 }; +1260 +1261 (function() { +1262 var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"]; +1263 for (var i = 0; i < functionNames.length; i++) { +1264 var functionName = functionNames[i]; +1265 jasmine.MultiReporter.prototype[functionName] = (function(functionName) { +1266 return function() { +1267 for (var j = 0; j < this.subReporters_.length; j++) { +1268 var subReporter = this.subReporters_[j]; +1269 if (subReporter[functionName]) { +1270 subReporter[functionName].apply(subReporter, arguments); +1271 } +1272 } +1273 }; +1274 })(functionName); +1275 } +1276 })(); +1277 /** +1278 * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults +1279 * +1280 * @constructor +1281 */ +1282 jasmine.NestedResults = function() { +1283 /** +1284 * The total count of results +1285 */ +1286 this.totalCount = 0; +1287 /** +1288 * Number of passed results +1289 */ +1290 this.passedCount = 0; +1291 /** +1292 * Number of failed results +1293 */ +1294 this.failedCount = 0; +1295 /** +1296 * Was this suite/spec skipped? +1297 */ +1298 this.skipped = false; +1299 /** +1300 * @ignore +1301 */ +1302 this.items_ = []; +1303 }; +1304 +1305 /** +1306 * Roll up the result counts. +1307 * +1308 * @param result +1309 */ +1310 jasmine.NestedResults.prototype.rollupCounts = function(result) { +1311 this.totalCount += result.totalCount; +1312 this.passedCount += result.passedCount; +1313 this.failedCount += result.failedCount; +1314 }; +1315 +1316 /** +1317 * Tracks a result's message. +1318 * @param message +1319 */ +1320 jasmine.NestedResults.prototype.log = function(message) { +1321 this.items_.push(new jasmine.MessageResult(message)); +1322 }; +1323 +1324 /** +1325 * Getter for the results: message & results. +1326 */ +1327 jasmine.NestedResults.prototype.getItems = function() { +1328 return this.items_; +1329 }; +1330 +1331 /** +1332 * Adds a result, tracking counts (total, passed, & failed) +1333 * @param {jasmine.ExpectationResult|jasmine.NestedResults} result +1334 */ +1335 jasmine.NestedResults.prototype.addResult = function(result) { +1336 if (result.type != 'MessageResult') { +1337 if (result.items_) { +1338 this.rollupCounts(result); +1339 } else { +1340 this.totalCount++; +1341 if (result.passed()) { +1342 this.passedCount++; +1343 } else { +1344 this.failedCount++; +1345 } +1346 } +1347 } +1348 this.items_.push(result); +1349 }; +1350 +1351 /** +1352 * @returns {Boolean} True if <b>everything</b> below passed +1353 */ +1354 jasmine.NestedResults.prototype.passed = function() { +1355 return this.passedCount === this.totalCount; +1356 }; +1357 /** +1358 * Base class for pretty printing for expectation results. +1359 */ +1360 jasmine.PrettyPrinter = function() { +1361 this.ppNestLevel_ = 0; +1362 }; +1363 +1364 /** +1365 * Formats a value in a nice, human-readable string. +1366 * +1367 * @param value +1368 * @returns {String} +1369 */ +1370 jasmine.PrettyPrinter.prototype.format = function(value) { +1371 if (this.ppNestLevel_ > 40) { +1372 // return '(jasmine.pp nested too deeply!)'; +1373 throw new Error('jasmine.PrettyPrinter: format() nested too deeply!'); +1374 } +1375 +1376 this.ppNestLevel_++; +1377 try { +1378 if (value === undefined) { +1379 this.emitScalar('undefined'); +1380 } else if (value === null) { +1381 this.emitScalar('null'); +1382 } else if (value.navigator && value.frames && value.setTimeout) { +1383 this.emitScalar('<window>'); +1384 } else if (value instanceof jasmine.Matchers.Any) { +1385 this.emitScalar(value.toString()); +1386 } else if (typeof value === 'string') { +1387 this.emitString(value); +1388 } else if (typeof value === 'function') { +1389 this.emitScalar('Function'); +1390 } else if (typeof value.nodeType === 'number') { +1391 this.emitScalar('HTMLNode'); +1392 } else if (value instanceof Date) { +1393 this.emitScalar('Date(' + value + ')'); +1394 } else if (value.__Jasmine_been_here_before__) { +1395 this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>'); +1396 } else if (jasmine.isArray_(value) || typeof value == 'object') { +1397 value.__Jasmine_been_here_before__ = true; +1398 if (jasmine.isArray_(value)) { +1399 this.emitArray(value); +1400 } else { +1401 this.emitObject(value); +1402 } +1403 delete value.__Jasmine_been_here_before__; +1404 } else { +1405 this.emitScalar(value.toString()); +1406 } +1407 } finally { +1408 this.ppNestLevel_--; +1409 } +1410 }; +1411 +1412 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { +1413 for (var property in obj) { +1414 if (property == '__Jasmine_been_here_before__') continue; +1415 fn(property, obj.__lookupGetter__(property) != null); +1416 } +1417 }; +1418 +1419 jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; +1420 jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; +1421 jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; +1422 jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; +1423 +1424 jasmine.StringPrettyPrinter = function() { +1425 jasmine.PrettyPrinter.call(this); +1426 +1427 this.string = ''; +1428 }; +1429 jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); +1430 +1431 jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { +1432 this.append(value); +1433 }; +1434 +1435 jasmine.StringPrettyPrinter.prototype.emitString = function(value) { +1436 this.append("'" + value + "'"); +1437 }; +1438 +1439 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { +1440 this.append('[ '); +1441 for (var i = 0; i < array.length; i++) { +1442 if (i > 0) { +1443 this.append(', '); +1444 } +1445 this.format(array[i]); +1446 } +1447 this.append(' ]'); +1448 }; +1449 +1450 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { +1451 var self = this; +1452 this.append('{ '); +1453 var first = true; +1454 +1455 this.iterateObject(obj, function(property, isGetter) { +1456 if (first) { +1457 first = false; +1458 } else { +1459 self.append(', '); +1460 } +1461 +1462 self.append(property); +1463 self.append(' : '); +1464 if (isGetter) { +1465 self.append('<getter>'); +1466 } else { +1467 self.format(obj[property]); +1468 } +1469 }); +1470 +1471 this.append(' }'); +1472 }; +1473 +1474 jasmine.StringPrettyPrinter.prototype.append = function(value) { +1475 this.string += value; +1476 }; +1477 jasmine.Queue = function(env) { +1478 this.env = env; +1479 this.blocks = []; +1480 this.running = false; +1481 this.index = 0; +1482 this.offset = 0; +1483 }; +1484 +1485 jasmine.Queue.prototype.addBefore = function(block) { +1486 this.blocks.unshift(block); +1487 }; +1488 +1489 jasmine.Queue.prototype.add = function(block) { +1490 this.blocks.push(block); +1491 }; +1492 +1493 jasmine.Queue.prototype.insertNext = function(block) { +1494 this.blocks.splice((this.index + this.offset + 1), 0, block); +1495 this.offset++; +1496 }; +1497 +1498 jasmine.Queue.prototype.start = function(onComplete) { +1499 this.running = true; +1500 this.onComplete = onComplete; +1501 this.next_(); +1502 }; +1503 +1504 jasmine.Queue.prototype.isRunning = function() { +1505 return this.running; +1506 }; +1507 +1508 jasmine.Queue.LOOP_DONT_RECURSE = true; +1509 +1510 jasmine.Queue.prototype.next_ = function() { +1511 var self = this; +1512 var goAgain = true; +1513 +1514 while (goAgain) { +1515 goAgain = false; +1516 +1517 if (self.index < self.blocks.length) { +1518 var calledSynchronously = true; +1519 var completedSynchronously = false; +1520 +1521 var onComplete = function () { +1522 if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { +1523 completedSynchronously = true; +1524 return; +1525 } +1526 +1527 self.offset = 0; +1528 self.index++; +1529 +1530 var now = new Date().getTime(); +1531 if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { +1532 self.env.lastUpdate = now; +1533 self.env.setTimeout(function() { +1534 self.next_(); +1535 }, 0); +1536 } else { +1537 if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { +1538 goAgain = true; +1539 } else { +1540 self.next_(); +1541 } +1542 } +1543 }; +1544 self.blocks[self.index].execute(onComplete); +1545 +1546 calledSynchronously = false; +1547 if (completedSynchronously) { +1548 onComplete(); +1549 } +1550 +1551 } else { +1552 self.running = false; +1553 if (self.onComplete) { +1554 self.onComplete(); +1555 } +1556 } +1557 } +1558 }; +1559 +1560 jasmine.Queue.prototype.results = function() { +1561 var results = new jasmine.NestedResults(); +1562 for (var i = 0; i < this.blocks.length; i++) { +1563 if (this.blocks[i].results) { +1564 results.addResult(this.blocks[i].results()); +1565 } +1566 } +1567 return results; +1568 }; +1569 1570 -1571 -1572 /* JasmineReporters.reporter -1573 * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to -1574 * descendants of this object to do something with the results (see json_reporter.js) -1575 */ -1576 jasmine.Reporters = {}; -1577 -1578 jasmine.Reporters.reporter = function(callbacks) { -1579 var that = { -1580 callbacks: callbacks || {}, -1581 -1582 doCallback: function(callback, results) { -1583 if (callback) { -1584 callback(results); -1585 } -1586 }, -1587 -1588 reportRunnerResults: function(runner) { -1589 that.doCallback(that.callbacks.runnerCallback, runner); -1590 }, -1591 reportSuiteResults: function(suite) { -1592 that.doCallback(that.callbacks.suiteCallback, suite); -1593 }, -1594 reportSpecResults: function(spec) { -1595 that.doCallback(that.callbacks.specCallback, spec); -1596 }, -1597 log: function (str) { -1598 if (console && console.log) console.log(str); -1599 } -1600 }; -1601 -1602 return that; -1603 }; -1604 -1605 /** -1606 * Runner -1607 * -1608 * @constructor -1609 * @param {jasmine.Env} env -1610 */ -1611 jasmine.Runner = function(env) { -1612 var self = this; -1613 self.env = env; -1614 self.queue = new jasmine.Queue(env); -1615 self.before_ = []; -1616 self.after_ = []; -1617 self.suites_ = []; -1618 }; -1619 -1620 jasmine.Runner.prototype.execute = function() { -1621 var self = this; -1622 if (self.env.reporter.reportRunnerStarting) { -1623 self.env.reporter.reportRunnerStarting(this); -1624 } -1625 self.queue.start(function () { -1626 self.finishCallback(); -1627 }); -1628 }; -1629 -1630 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { -1631 beforeEachFunction.typeName = 'beforeEach'; -1632 this.before_.push(beforeEachFunction); -1633 }; -1634 -1635 jasmine.Runner.prototype.afterEach = function(afterEachFunction) { -1636 afterEachFunction.typeName = 'afterEach'; -1637 this.after_.push(afterEachFunction); -1638 }; +1571 /* JasmineReporters.reporter +1572 * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to +1573 * descendants of this object to do something with the results (see json_reporter.js) +1574 */ +1575 jasmine.Reporters = {}; +1576 +1577 jasmine.Reporters.reporter = function(callbacks) { +1578 var that = { +1579 callbacks: callbacks || {}, +1580 +1581 doCallback: function(callback, results) { +1582 if (callback) { +1583 callback(results); +1584 } +1585 }, +1586 +1587 reportRunnerResults: function(runner) { +1588 that.doCallback(that.callbacks.runnerCallback, runner); +1589 }, +1590 reportSuiteResults: function(suite) { +1591 that.doCallback(that.callbacks.suiteCallback, suite); +1592 }, +1593 reportSpecResults: function(spec) { +1594 that.doCallback(that.callbacks.specCallback, spec); +1595 }, +1596 log: function (str) { +1597 if (console && console.log) console.log(str); +1598 } +1599 }; +1600 +1601 return that; +1602 }; +1603 +1604 /** +1605 * Runner +1606 * +1607 * @constructor +1608 * @param {jasmine.Env} env +1609 */ +1610 jasmine.Runner = function(env) { +1611 var self = this; +1612 self.env = env; +1613 self.queue = new jasmine.Queue(env); +1614 self.before_ = []; +1615 self.after_ = []; +1616 self.suites_ = []; +1617 }; +1618 +1619 jasmine.Runner.prototype.execute = function() { +1620 var self = this; +1621 if (self.env.reporter.reportRunnerStarting) { +1622 self.env.reporter.reportRunnerStarting(this); +1623 } +1624 self.queue.start(function () { +1625 self.finishCallback(); +1626 }); +1627 }; +1628 +1629 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { +1630 beforeEachFunction.typeName = 'beforeEach'; +1631 this.before_.push(beforeEachFunction); +1632 }; +1633 +1634 jasmine.Runner.prototype.afterEach = function(afterEachFunction) { +1635 afterEachFunction.typeName = 'afterEach'; +1636 this.after_.push(afterEachFunction); +1637 }; +1638 1639 -1640 -1641 jasmine.Runner.prototype.finishCallback = function() { -1642 this.env.reporter.reportRunnerResults(this); -1643 }; -1644 -1645 jasmine.Runner.prototype.addSuite = function(suite) { -1646 this.suites_.push(suite); -1647 }; -1648 -1649 jasmine.Runner.prototype.add = function(block) { -1650 if (block instanceof jasmine.Suite) { -1651 this.addSuite(block); -1652 } -1653 this.queue.add(block); -1654 }; -1655 -1656 /** @deprecated */ -1657 jasmine.Runner.prototype.getAllSuites = function() { -1658 return this.suites_; -1659 }; +1640 jasmine.Runner.prototype.finishCallback = function() { +1641 this.env.reporter.reportRunnerResults(this); +1642 }; +1643 +1644 jasmine.Runner.prototype.addSuite = function(suite) { +1645 this.suites_.push(suite); +1646 }; +1647 +1648 jasmine.Runner.prototype.add = function(block) { +1649 if (block instanceof jasmine.Suite) { +1650 this.addSuite(block); +1651 } +1652 this.queue.add(block); +1653 }; +1654 +1655 /** @deprecated */ +1656 jasmine.Runner.prototype.getAllSuites = function() { +1657 return this.suites_; +1658 }; +1659 1660 -1661 -1662 jasmine.Runner.prototype.suites = function() { -1663 return this.suites_; -1664 }; -1665 -1666 jasmine.Runner.prototype.results = function() { -1667 return this.queue.results(); -1668 }; -1669 -1670 /** @deprecated */ -1671 jasmine.Runner.prototype.getResults = function() { -1672 return this.queue.results(); -1673 }; -1674 /** -1675 * Internal representation of a Jasmine specification, or test. -1676 * -1677 * @constructor -1678 * @param {jasmine.Env} env -1679 * @param {jasmine.Suite} suite -1680 * @param {String} description -1681 */ -1682 jasmine.Spec = function(env, suite, description) { -1683 if (!env) { -1684 throw new Error('jasmine.Env() required'); -1685 } -1686 ; -1687 if (!suite) { -1688 throw new Error('jasmine.Suite() required'); -1689 } -1690 ; -1691 var spec = this; -1692 spec.id = env.nextSpecId ? env.nextSpecId() : null; -1693 spec.env = env; -1694 spec.suite = suite; -1695 spec.description = description; -1696 spec.queue = new jasmine.Queue(env); -1697 -1698 spec.afterCallbacks = []; -1699 spec.spies_ = []; -1700 -1701 spec.results_ = new jasmine.NestedResults(); -1702 spec.results_.description = description; -1703 spec.matchersClass = null; -1704 }; -1705 -1706 jasmine.Spec.prototype.getFullName = function() { -1707 return this.suite.getFullName() + ' ' + this.description + '.'; -1708 }; +1661 jasmine.Runner.prototype.suites = function() { +1662 return this.suites_; +1663 }; +1664 +1665 jasmine.Runner.prototype.results = function() { +1666 return this.queue.results(); +1667 }; +1668 +1669 /** @deprecated */ +1670 jasmine.Runner.prototype.getResults = function() { +1671 return this.queue.results(); +1672 }; +1673 /** +1674 * Internal representation of a Jasmine specification, or test. +1675 * +1676 * @constructor +1677 * @param {jasmine.Env} env +1678 * @param {jasmine.Suite} suite +1679 * @param {String} description +1680 */ +1681 jasmine.Spec = function(env, suite, description) { +1682 if (!env) { +1683 throw new Error('jasmine.Env() required'); +1684 } +1685 ; +1686 if (!suite) { +1687 throw new Error('jasmine.Suite() required'); +1688 } +1689 ; +1690 var spec = this; +1691 spec.id = env.nextSpecId ? env.nextSpecId() : null; +1692 spec.env = env; +1693 spec.suite = suite; +1694 spec.description = description; +1695 spec.queue = new jasmine.Queue(env); +1696 +1697 spec.afterCallbacks = []; +1698 spec.spies_ = []; +1699 +1700 spec.results_ = new jasmine.NestedResults(); +1701 spec.results_.description = description; +1702 spec.matchersClass = null; +1703 }; +1704 +1705 jasmine.Spec.prototype.getFullName = function() { +1706 return this.suite.getFullName() + ' ' + this.description + '.'; +1707 }; +1708 1709 -1710 -1711 jasmine.Spec.prototype.results = function() { -1712 return this.results_; -1713 }; -1714 -1715 jasmine.Spec.prototype.log = function(message) { -1716 return this.results_.log(message); -1717 }; -1718 -1719 /** @deprecated */ -1720 jasmine.Spec.prototype.getResults = function() { -1721 return this.results_; -1722 }; -1723 -1724 jasmine.Spec.prototype.runs = function (func) { -1725 var block = new jasmine.Block(this.env, func, this); -1726 this.addToQueue(block); -1727 return this; -1728 }; -1729 -1730 jasmine.Spec.prototype.addToQueue = function (block) { -1731 if (this.queue.isRunning()) { -1732 this.queue.insertNext(block); -1733 } else { -1734 this.queue.add(block); -1735 } -1736 }; -1737 -1738 /** -1739 * @private -1740 * @deprecated -1741 */ -1742 jasmine.Spec.prototype.expects_that = function(actual) { -1743 return this.expect(actual); -1744 }; -1745 -1746 jasmine.Spec.prototype.expect = function(actual) { -1747 return new (this.getMatchersClass_())(this.env, actual, this.results_); -1748 }; -1749 -1750 jasmine.Spec.prototype.waits = function(timeout) { -1751 var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); -1752 this.addToQueue(waitsFunc); -1753 return this; -1754 }; -1755 -1756 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) { -1757 var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this); -1758 this.addToQueue(waitsForFunc); -1759 return this; -1760 }; -1761 -1762 jasmine.Spec.prototype.fail = function (e) { -1763 this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null)); -1764 }; -1765 -1766 jasmine.Spec.prototype.getMatchersClass_ = function() { -1767 return this.matchersClass || jasmine.Matchers; -1768 }; -1769 -1770 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { -1771 var parent = this.getMatchersClass_(); -1772 var newMatchersClass = function() { -1773 parent.apply(this, arguments); -1774 }; -1775 jasmine.util.inherit(newMatchersClass, parent); -1776 for (var method in matchersPrototype) { -1777 newMatchersClass.prototype[method] = matchersPrototype[method]; -1778 } -1779 this.matchersClass = newMatchersClass; -1780 }; -1781 -1782 jasmine.Spec.prototype.finishCallback = function() { -1783 this.env.reporter.reportSpecResults(this); -1784 }; -1785 -1786 jasmine.Spec.prototype.finish = function(onComplete) { -1787 this.removeAllSpies(); -1788 this.finishCallback(); -1789 if (onComplete) { -1790 onComplete(); -1791 } -1792 }; -1793 -1794 jasmine.Spec.prototype.after = function(doAfter, test) { -1795 -1796 if (this.queue.isRunning()) { -1797 this.queue.add(new jasmine.Block(this.env, doAfter, this)); -1798 } else { -1799 this.afterCallbacks.unshift(doAfter); -1800 } -1801 }; -1802 -1803 jasmine.Spec.prototype.execute = function(onComplete) { -1804 var spec = this; -1805 if (!spec.env.specFilter(spec)) { -1806 spec.results_.skipped = true; -1807 spec.finish(onComplete); -1808 return; -1809 } -1810 this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...'); -1811 -1812 spec.env.currentSpec = spec; -1813 spec.env.currentlyRunningTests = true; -1814 -1815 spec.addBeforesAndAftersToQueue(); -1816 -1817 spec.queue.start(function () { -1818 spec.finish(onComplete); -1819 }); -1820 spec.env.currentlyRunningTests = false; -1821 }; -1822 -1823 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { -1824 var runner = this.env.currentRunner(); -1825 for (var suite = this.suite; suite; suite = suite.parentSuite) { -1826 for (var i = 0; i < suite.before_.length; i++) { -1827 this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); -1828 } -1829 } -1830 for (var i = 0; i < runner.before_.length; i++) { -1831 this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); -1832 } -1833 for (i = 0; i < this.afterCallbacks.length; i++) { -1834 this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); -1835 } -1836 for (suite = this.suite; suite; suite = suite.parentSuite) { -1837 for (var i = 0; i < suite.after_.length; i++) { -1838 this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); -1839 } -1840 } -1841 for (var i = 0; i < runner.after_.length; i++) { -1842 this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); -1843 } -1844 }; -1845 -1846 jasmine.Spec.prototype.explodes = function() { -1847 throw 'explodes function should not have been called'; -1848 }; -1849 -1850 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { -1851 if (obj == undefined) { -1852 throw "spyOn could not find an object to spy upon for " + methodName + "()"; -1853 } -1854 -1855 if (!ignoreMethodDoesntExist && obj[methodName] === undefined) { -1856 throw methodName + '() method does not exist'; -1857 } -1858 -1859 if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { -1860 throw new Error(methodName + ' has already been spied upon'); -1861 } -1862 -1863 var spyObj = jasmine.createSpy(methodName); -1864 -1865 this.spies_.push(spyObj); -1866 spyObj.baseObj = obj; -1867 spyObj.methodName = methodName; -1868 spyObj.originalValue = obj[methodName]; -1869 -1870 obj[methodName] = spyObj; -1871 -1872 return spyObj; -1873 }; -1874 -1875 jasmine.Spec.prototype.removeAllSpies = function() { -1876 for (var i = 0; i < this.spies_.length; i++) { -1877 var spy = this.spies_[i]; -1878 spy.baseObj[spy.methodName] = spy.originalValue; -1879 } -1880 this.spies_ = []; -1881 }; -1882 -1883 /** -1884 * Internal representation of a Jasmine suite. -1885 * -1886 * @constructor -1887 * @param {jasmine.Env} env -1888 * @param {String} description -1889 * @param {Function} specDefinitions -1890 * @param {jasmine.Suite} parentSuite -1891 */ -1892 jasmine.Suite = function(env, description, specDefinitions, parentSuite) { -1893 var self = this; -1894 self.id = env.nextSuiteId ? env.nextSuiteId() : null; -1895 self.description = description; -1896 self.queue = new jasmine.Queue(env); -1897 self.parentSuite = parentSuite; -1898 self.env = env; -1899 self.before_ = []; -1900 self.after_ = []; -1901 self.specs_ = []; -1902 }; -1903 -1904 jasmine.Suite.prototype.getFullName = function() { -1905 var fullName = this.description; -1906 for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { -1907 fullName = parentSuite.description + ' ' + fullName; -1908 } -1909 return fullName; -1910 }; -1911 -1912 jasmine.Suite.prototype.finish = function(onComplete) { -1913 this.env.reporter.reportSuiteResults(this); -1914 this.finished = true; -1915 if (typeof(onComplete) == 'function') { -1916 onComplete(); -1917 } -1918 }; -1919 -1920 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { -1921 beforeEachFunction.typeName = 'beforeEach'; -1922 this.before_.push(beforeEachFunction); -1923 }; -1924 -1925 jasmine.Suite.prototype.afterEach = function(afterEachFunction) { -1926 afterEachFunction.typeName = 'afterEach'; -1927 this.after_.push(afterEachFunction); -1928 }; -1929 -1930 /** @deprecated */ -1931 jasmine.Suite.prototype.getResults = function() { -1932 return this.queue.results(); -1933 }; -1934 -1935 jasmine.Suite.prototype.results = function() { -1936 return this.queue.results(); -1937 }; -1938 -1939 jasmine.Suite.prototype.add = function(block) { -1940 if (block instanceof jasmine.Suite) { -1941 this.env.currentRunner().addSuite(block); -1942 } else { -1943 this.specs_.push(block); -1944 } -1945 this.queue.add(block); -1946 }; -1947 -1948 /** @deprecated */ -1949 jasmine.Suite.prototype.specCount = function() { -1950 return this.specs_.length; -1951 }; -1952 -1953 jasmine.Suite.prototype.specs = function() { -1954 return this.specs_; -1955 }; -1956 -1957 jasmine.Suite.prototype.execute = function(onComplete) { -1958 var self = this; -1959 this.queue.start(function () { -1960 self.finish(onComplete); -1961 }); -1962 }; -1963 jasmine.WaitsBlock = function(env, timeout, spec) { -1964 this.timeout = timeout; -1965 jasmine.Block.call(this, env, null, spec); -1966 }; -1967 -1968 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); -1969 -1970 jasmine.WaitsBlock.prototype.execute = function (onComplete) { -1971 this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); -1972 this.env.setTimeout(function () { -1973 onComplete(); -1974 }, this.timeout); -1975 }; -1976 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { -1977 this.timeout = timeout; -1978 this.latchFunction = latchFunction; -1979 this.message = message; -1980 this.totalTimeSpentWaitingForLatch = 0; -1981 jasmine.Block.call(this, env, null, spec); -1982 }; -1983 -1984 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); -1985 -1986 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100; -1987 -1988 jasmine.WaitsForBlock.prototype.execute = function (onComplete) { -1989 var self = this; -1990 self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen')); -1991 var latchFunctionResult; -1992 try { -1993 latchFunctionResult = self.latchFunction.apply(self.spec); -1994 } catch (e) { -1995 self.spec.fail(e); -1996 onComplete(); -1997 return; -1998 } -1999 -2000 if (latchFunctionResult) { -2001 onComplete(); -2002 } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) { -2003 var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen'); -2004 self.spec.fail({ -2005 name: 'timeout', -2006 message: message -2007 }); -2008 self.spec._next(); -2009 } else { -2010 self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; -2011 self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); -2012 } -2013 }; -2014 // Mock setTimeout, clearTimeout -2015 // Contributed by Pivotal Computer Systems, www.pivotalsf.com -2016 -2017 jasmine.FakeTimer = function() { -2018 this.reset(); -2019 -2020 var self = this; -2021 self.setTimeout = function(funcToCall, millis) { -2022 self.timeoutsMade++; -2023 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); -2024 return self.timeoutsMade; -2025 }; -2026 -2027 self.setInterval = function(funcToCall, millis) { -2028 self.timeoutsMade++; -2029 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); -2030 return self.timeoutsMade; -2031 }; -2032 -2033 self.clearTimeout = function(timeoutKey) { -2034 self.scheduledFunctions[timeoutKey] = undefined; -2035 }; -2036 -2037 self.clearInterval = function(timeoutKey) { -2038 self.scheduledFunctions[timeoutKey] = undefined; -2039 }; -2040 -2041 }; -2042 -2043 jasmine.FakeTimer.prototype.reset = function() { -2044 this.timeoutsMade = 0; -2045 this.scheduledFunctions = {}; -2046 this.nowMillis = 0; -2047 }; -2048 -2049 jasmine.FakeTimer.prototype.tick = function(millis) { -2050 var oldMillis = this.nowMillis; -2051 var newMillis = oldMillis + millis; -2052 this.runFunctionsWithinRange(oldMillis, newMillis); -2053 this.nowMillis = newMillis; -2054 }; -2055 -2056 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { -2057 var scheduledFunc; -2058 var funcsToRun = []; -2059 for (var timeoutKey in this.scheduledFunctions) { -2060 scheduledFunc = this.scheduledFunctions[timeoutKey]; -2061 if (scheduledFunc != undefined && -2062 scheduledFunc.runAtMillis >= oldMillis && -2063 scheduledFunc.runAtMillis <= nowMillis) { -2064 funcsToRun.push(scheduledFunc); -2065 this.scheduledFunctions[timeoutKey] = undefined; -2066 } -2067 } -2068 -2069 if (funcsToRun.length > 0) { -2070 funcsToRun.sort(function(a, b) { -2071 return a.runAtMillis - b.runAtMillis; -2072 }); -2073 for (var i = 0; i < funcsToRun.length; ++i) { -2074 try { -2075 var funcToRun = funcsToRun[i]; -2076 this.nowMillis = funcToRun.runAtMillis; -2077 funcToRun.funcToCall(); -2078 if (funcToRun.recurring) { -2079 this.scheduleFunction(funcToRun.timeoutKey, -2080 funcToRun.funcToCall, -2081 funcToRun.millis, -2082 true); -2083 } -2084 } catch(e) { -2085 } -2086 } -2087 this.runFunctionsWithinRange(oldMillis, nowMillis); -2088 } -2089 }; -2090 -2091 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { -2092 this.scheduledFunctions[timeoutKey] = { -2093 runAtMillis: this.nowMillis + millis, -2094 funcToCall: funcToCall, -2095 recurring: recurring, -2096 timeoutKey: timeoutKey, -2097 millis: millis -2098 }; -2099 }; +1710 jasmine.Spec.prototype.results = function() { +1711 return this.results_; +1712 }; +1713 +1714 jasmine.Spec.prototype.log = function(message) { +1715 return this.results_.log(message); +1716 }; +1717 +1718 /** @deprecated */ +1719 jasmine.Spec.prototype.getResults = function() { +1720 return this.results_; +1721 }; +1722 +1723 jasmine.Spec.prototype.runs = function (func) { +1724 var block = new jasmine.Block(this.env, func, this); +1725 this.addToQueue(block); +1726 return this; +1727 }; +1728 +1729 jasmine.Spec.prototype.addToQueue = function (block) { +1730 if (this.queue.isRunning()) { +1731 this.queue.insertNext(block); +1732 } else { +1733 this.queue.add(block); +1734 } +1735 }; +1736 +1737 /** +1738 * @private +1739 * @deprecated +1740 */ +1741 jasmine.Spec.prototype.expects_that = function(actual) { +1742 return this.expect(actual); +1743 }; +1744 +1745 jasmine.Spec.prototype.expect = function(actual) { +1746 return new (this.getMatchersClass_())(this.env, actual, this.results_); +1747 }; +1748 +1749 jasmine.Spec.prototype.waits = function(timeout) { +1750 var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); +1751 this.addToQueue(waitsFunc); +1752 return this; +1753 }; +1754 +1755 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) { +1756 var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this); +1757 this.addToQueue(waitsForFunc); +1758 return this; +1759 }; +1760 +1761 jasmine.Spec.prototype.fail = function (e) { +1762 this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null)); +1763 }; +1764 +1765 jasmine.Spec.prototype.getMatchersClass_ = function() { +1766 return this.matchersClass || jasmine.Matchers; +1767 }; +1768 +1769 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { +1770 var parent = this.getMatchersClass_(); +1771 var newMatchersClass = function() { +1772 parent.apply(this, arguments); +1773 }; +1774 jasmine.util.inherit(newMatchersClass, parent); +1775 for (var method in matchersPrototype) { +1776 newMatchersClass.prototype[method] = matchersPrototype[method]; +1777 } +1778 this.matchersClass = newMatchersClass; +1779 }; +1780 +1781 jasmine.Spec.prototype.finishCallback = function() { +1782 this.env.reporter.reportSpecResults(this); +1783 }; +1784 +1785 jasmine.Spec.prototype.finish = function(onComplete) { +1786 this.removeAllSpies(); +1787 this.finishCallback(); +1788 if (onComplete) { +1789 onComplete(); +1790 } +1791 }; +1792 +1793 jasmine.Spec.prototype.after = function(doAfter, test) { +1794 +1795 if (this.queue.isRunning()) { +1796 this.queue.add(new jasmine.Block(this.env, doAfter, this)); +1797 } else { +1798 this.afterCallbacks.unshift(doAfter); +1799 } +1800 }; +1801 +1802 jasmine.Spec.prototype.execute = function(onComplete) { +1803 var spec = this; +1804 if (!spec.env.specFilter(spec)) { +1805 spec.results_.skipped = true; +1806 spec.finish(onComplete); +1807 return; +1808 } +1809 this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...'); +1810 +1811 spec.env.currentSpec = spec; +1812 spec.env.currentlyRunningTests = true; +1813 +1814 spec.addBeforesAndAftersToQueue(); +1815 +1816 spec.queue.start(function () { +1817 spec.finish(onComplete); +1818 }); +1819 spec.env.currentlyRunningTests = false; +1820 }; +1821 +1822 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { +1823 var runner = this.env.currentRunner(); +1824 for (var suite = this.suite; suite; suite = suite.parentSuite) { +1825 for (var i = 0; i < suite.before_.length; i++) { +1826 this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); +1827 } +1828 } +1829 for (var i = 0; i < runner.before_.length; i++) { +1830 this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); +1831 } +1832 for (i = 0; i < this.afterCallbacks.length; i++) { +1833 this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); +1834 } +1835 for (suite = this.suite; suite; suite = suite.parentSuite) { +1836 for (var i = 0; i < suite.after_.length; i++) { +1837 this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); +1838 } +1839 } +1840 for (var i = 0; i < runner.after_.length; i++) { +1841 this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); +1842 } +1843 }; +1844 +1845 jasmine.Spec.prototype.explodes = function() { +1846 throw 'explodes function should not have been called'; +1847 }; +1848 +1849 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { +1850 if (obj == undefined) { +1851 throw "spyOn could not find an object to spy upon for " + methodName + "()"; +1852 } +1853 +1854 if (!ignoreMethodDoesntExist && obj[methodName] === undefined) { +1855 throw methodName + '() method does not exist'; +1856 } +1857 +1858 if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { +1859 throw new Error(methodName + ' has already been spied upon'); +1860 } +1861 +1862 var spyObj = jasmine.createSpy(methodName); +1863 +1864 this.spies_.push(spyObj); +1865 spyObj.baseObj = obj; +1866 spyObj.methodName = methodName; +1867 spyObj.originalValue = obj[methodName]; +1868 +1869 obj[methodName] = spyObj; +1870 +1871 return spyObj; +1872 }; +1873 +1874 jasmine.Spec.prototype.removeAllSpies = function() { +1875 for (var i = 0; i < this.spies_.length; i++) { +1876 var spy = this.spies_[i]; +1877 spy.baseObj[spy.methodName] = spy.originalValue; +1878 } +1879 this.spies_ = []; +1880 }; +1881 +1882 /** +1883 * Internal representation of a Jasmine suite. +1884 * +1885 * @constructor +1886 * @param {jasmine.Env} env +1887 * @param {String} description +1888 * @param {Function} specDefinitions +1889 * @param {jasmine.Suite} parentSuite +1890 */ +1891 jasmine.Suite = function(env, description, specDefinitions, parentSuite) { +1892 var self = this; +1893 self.id = env.nextSuiteId ? env.nextSuiteId() : null; +1894 self.description = description; +1895 self.queue = new jasmine.Queue(env); +1896 self.parentSuite = parentSuite; +1897 self.env = env; +1898 self.before_ = []; +1899 self.after_ = []; +1900 self.specs_ = []; +1901 }; +1902 +1903 jasmine.Suite.prototype.getFullName = function() { +1904 var fullName = this.description; +1905 for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { +1906 fullName = parentSuite.description + ' ' + fullName; +1907 } +1908 return fullName; +1909 }; +1910 +1911 jasmine.Suite.prototype.finish = function(onComplete) { +1912 this.env.reporter.reportSuiteResults(this); +1913 this.finished = true; +1914 if (typeof(onComplete) == 'function') { +1915 onComplete(); +1916 } +1917 }; +1918 +1919 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { +1920 beforeEachFunction.typeName = 'beforeEach'; +1921 this.before_.push(beforeEachFunction); +1922 }; +1923 +1924 jasmine.Suite.prototype.afterEach = function(afterEachFunction) { +1925 afterEachFunction.typeName = 'afterEach'; +1926 this.after_.push(afterEachFunction); +1927 }; +1928 +1929 /** @deprecated */ +1930 jasmine.Suite.prototype.getResults = function() { +1931 return this.queue.results(); +1932 }; +1933 +1934 jasmine.Suite.prototype.results = function() { +1935 return this.queue.results(); +1936 }; +1937 +1938 jasmine.Suite.prototype.add = function(block) { +1939 if (block instanceof jasmine.Suite) { +1940 this.env.currentRunner().addSuite(block); +1941 } else { +1942 this.specs_.push(block); +1943 } +1944 this.queue.add(block); +1945 }; +1946 +1947 /** @deprecated */ +1948 jasmine.Suite.prototype.specCount = function() { +1949 return this.specs_.length; +1950 }; +1951 +1952 jasmine.Suite.prototype.specs = function() { +1953 return this.specs_; +1954 }; +1955 +1956 jasmine.Suite.prototype.execute = function(onComplete) { +1957 var self = this; +1958 this.queue.start(function () { +1959 self.finish(onComplete); +1960 }); +1961 }; +1962 jasmine.WaitsBlock = function(env, timeout, spec) { +1963 this.timeout = timeout; +1964 jasmine.Block.call(this, env, null, spec); +1965 }; +1966 +1967 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); +1968 +1969 jasmine.WaitsBlock.prototype.execute = function (onComplete) { +1970 this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); +1971 this.env.setTimeout(function () { +1972 onComplete(); +1973 }, this.timeout); +1974 }; +1975 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { +1976 this.timeout = timeout; +1977 this.latchFunction = latchFunction; +1978 this.message = message; +1979 this.totalTimeSpentWaitingForLatch = 0; +1980 jasmine.Block.call(this, env, null, spec); +1981 }; +1982 +1983 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); +1984 +1985 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100; +1986 +1987 jasmine.WaitsForBlock.prototype.execute = function (onComplete) { +1988 var self = this; +1989 self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen')); +1990 var latchFunctionResult; +1991 try { +1992 latchFunctionResult = self.latchFunction.apply(self.spec); +1993 } catch (e) { +1994 self.spec.fail(e); +1995 onComplete(); +1996 return; +1997 } +1998 +1999 if (latchFunctionResult) { +2000 onComplete(); +2001 } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) { +2002 var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen'); +2003 self.spec.fail({ +2004 name: 'timeout', +2005 message: message +2006 }); +2007 self.spec._next(); +2008 } else { +2009 self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; +2010 self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); +2011 } +2012 }; +2013 // Mock setTimeout, clearTimeout +2014 // Contributed by Pivotal Computer Systems, www.pivotalsf.com +2015 +2016 jasmine.FakeTimer = function() { +2017 this.reset(); +2018 +2019 var self = this; +2020 self.setTimeout = function(funcToCall, millis) { +2021 self.timeoutsMade++; +2022 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); +2023 return self.timeoutsMade; +2024 }; +2025 +2026 self.setInterval = function(funcToCall, millis) { +2027 self.timeoutsMade++; +2028 self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); +2029 return self.timeoutsMade; +2030 }; +2031 +2032 self.clearTimeout = function(timeoutKey) { +2033 self.scheduledFunctions[timeoutKey] = undefined; +2034 }; +2035 +2036 self.clearInterval = function(timeoutKey) { +2037 self.scheduledFunctions[timeoutKey] = undefined; +2038 }; +2039 +2040 }; +2041 +2042 jasmine.FakeTimer.prototype.reset = function() { +2043 this.timeoutsMade = 0; +2044 this.scheduledFunctions = {}; +2045 this.nowMillis = 0; +2046 }; +2047 +2048 jasmine.FakeTimer.prototype.tick = function(millis) { +2049 var oldMillis = this.nowMillis; +2050 var newMillis = oldMillis + millis; +2051 this.runFunctionsWithinRange(oldMillis, newMillis); +2052 this.nowMillis = newMillis; +2053 }; +2054 +2055 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { +2056 var scheduledFunc; +2057 var funcsToRun = []; +2058 for (var timeoutKey in this.scheduledFunctions) { +2059 scheduledFunc = this.scheduledFunctions[timeoutKey]; +2060 if (scheduledFunc != undefined && +2061 scheduledFunc.runAtMillis >= oldMillis && +2062 scheduledFunc.runAtMillis <= nowMillis) { +2063 funcsToRun.push(scheduledFunc); +2064 this.scheduledFunctions[timeoutKey] = undefined; +2065 } +2066 } +2067 +2068 if (funcsToRun.length > 0) { +2069 funcsToRun.sort(function(a, b) { +2070 return a.runAtMillis - b.runAtMillis; +2071 }); +2072 for (var i = 0; i < funcsToRun.length; ++i) { +2073 try { +2074 var funcToRun = funcsToRun[i]; +2075 this.nowMillis = funcToRun.runAtMillis; +2076 funcToRun.funcToCall(); +2077 if (funcToRun.recurring) { +2078 this.scheduleFunction(funcToRun.timeoutKey, +2079 funcToRun.funcToCall, +2080 funcToRun.millis, +2081 true); +2082 } +2083 } catch(e) { +2084 } +2085 } +2086 this.runFunctionsWithinRange(oldMillis, nowMillis); +2087 } +2088 }; +2089 +2090 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { +2091 this.scheduledFunctions[timeoutKey] = { +2092 runAtMillis: this.nowMillis + millis, +2093 funcToCall: funcToCall, +2094 recurring: recurring, +2095 timeoutKey: timeoutKey, +2096 millis: millis +2097 }; +2098 }; +2099 2100 -2101 -2102 jasmine.Clock = { -2103 defaultFakeTimer: new jasmine.FakeTimer(), -2104 -2105 reset: function() { -2106 jasmine.Clock.assertInstalled(); -2107 jasmine.Clock.defaultFakeTimer.reset(); -2108 }, -2109 -2110 tick: function(millis) { -2111 jasmine.Clock.assertInstalled(); -2112 jasmine.Clock.defaultFakeTimer.tick(millis); -2113 }, -2114 -2115 runFunctionsWithinRange: function(oldMillis, nowMillis) { -2116 jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); -2117 }, -2118 -2119 scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { -2120 jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); -2121 }, -2122 -2123 useMock: function() { -2124 var spec = jasmine.getEnv().currentSpec; -2125 spec.after(jasmine.Clock.uninstallMock); -2126 -2127 jasmine.Clock.installMock(); -2128 }, -2129 -2130 installMock: function() { -2131 jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; -2132 }, -2133 -2134 uninstallMock: function() { -2135 jasmine.Clock.assertInstalled(); -2136 jasmine.Clock.installed = jasmine.Clock.real; -2137 }, -2138 -2139 real: { -2140 setTimeout: window.setTimeout, -2141 clearTimeout: window.clearTimeout, -2142 setInterval: window.setInterval, -2143 clearInterval: window.clearInterval -2144 }, -2145 -2146 assertInstalled: function() { -2147 if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { -2148 throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); -2149 } -2150 }, -2151 -2152 installed: null -2153 }; -2154 jasmine.Clock.installed = jasmine.Clock.real; -2155 -2156 window.setTimeout = function(funcToCall, millis) { -2157 return jasmine.Clock.installed.setTimeout.apply(this, arguments); -2158 }; -2159 -2160 window.setInterval = function(funcToCall, millis) { -2161 return jasmine.Clock.installed.setInterval.apply(this, arguments); -2162 }; -2163 -2164 window.clearTimeout = function(timeoutKey) { -2165 return jasmine.Clock.installed.clearTimeout.apply(this, arguments); -2166 }; -2167 -2168 window.clearInterval = function(timeoutKey) { -2169 return jasmine.Clock.installed.clearInterval.apply(this, arguments); -2170 }; -2171 -2172 \ No newline at end of file +2101 jasmine.Clock = { +2102 defaultFakeTimer: new jasmine.FakeTimer(), +2103 +2104 reset: function() { +2105 jasmine.Clock.assertInstalled(); +2106 jasmine.Clock.defaultFakeTimer.reset(); +2107 }, +2108 +2109 tick: function(millis) { +2110 jasmine.Clock.assertInstalled(); +2111 jasmine.Clock.defaultFakeTimer.tick(millis); +2112 }, +2113 +2114 runFunctionsWithinRange: function(oldMillis, nowMillis) { +2115 jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); +2116 }, +2117 +2118 scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { +2119 jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); +2120 }, +2121 +2122 useMock: function() { +2123 var spec = jasmine.getEnv().currentSpec; +2124 spec.after(jasmine.Clock.uninstallMock); +2125 +2126 jasmine.Clock.installMock(); +2127 }, +2128 +2129 installMock: function() { +2130 jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; +2131 }, +2132 +2133 uninstallMock: function() { +2134 jasmine.Clock.assertInstalled(); +2135 jasmine.Clock.installed = jasmine.Clock.real; +2136 }, +2137 +2138 real: { +2139 setTimeout: window.setTimeout, +2140 clearTimeout: window.clearTimeout, +2141 setInterval: window.setInterval, +2142 clearInterval: window.clearInterval +2143 }, +2144 +2145 assertInstalled: function() { +2146 if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { +2147 throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); +2148 } +2149 }, +2150 +2151 installed: null +2152 }; +2153 jasmine.Clock.installed = jasmine.Clock.real; +2154 +2155 window.setTimeout = function(funcToCall, millis) { +2156 return jasmine.Clock.installed.setTimeout.apply(this, arguments); +2157 }; +2158 +2159 window.setInterval = function(funcToCall, millis) { +2160 return jasmine.Clock.installed.setInterval.apply(this, arguments); +2161 }; +2162 +2163 window.clearTimeout = function(timeoutKey) { +2164 return jasmine.Clock.installed.clearTimeout.apply(this, arguments); +2165 }; +2166 +2167 window.clearInterval = function(timeoutKey) { +2168 return jasmine.Clock.installed.clearInterval.apply(this, arguments); +2169 }; +2170 +2171 \ No newline at end of file diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index faec0a5..3e8825a 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -189,6 +189,7 @@ jasmine.Spy = function(name) { * mySpy.argsForCall[1] = [7, 8]; */ this.argsForCall = []; + this.calls = []; }; /** @@ -283,6 +284,7 @@ jasmine.Spy.prototype.reset = function() { this.wasCalled = false; this.callCount = 0; this.argsForCall = []; + this.calls = []; this.mostRecentCall = {}; }; @@ -292,13 +294,10 @@ jasmine.createSpy = function(name) { spyObj.wasCalled = true; spyObj.callCount++; var args = jasmine.util.argsToArray(arguments); - //spyObj.mostRecentCall = { - // object: this, - // args: args - //}; spyObj.mostRecentCall.object = this; spyObj.mostRecentCall.args = args; spyObj.argsForCall.push(args); + spyObj.calls.push({object: this, args: args}); return spyObj.plan.apply(this, arguments); }; @@ -523,7 +522,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1255468502 + "revision": 1255470394 }; /** * @namespace From 1b1c2b199813196ab7bfc86ec20993becd58759f Mon Sep 17 00:00:00 2001 From: Rajan Agaskar & Ryan Dy Date: Tue, 13 Oct 2009 15:16:20 -0700 Subject: [PATCH 11/18] Allow jasmine::runner to take an optional list of styesheets --- contrib/ruby/jasmine_runner.rb | 4 +++- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 2 +- lib/jasmine-0.9.0.js | 2 +- 18 files changed, 20 insertions(+), 18 deletions(-) diff --git a/contrib/ruby/jasmine_runner.rb b/contrib/ruby/jasmine_runner.rb index ce98c1e..6d27b6b 100644 --- a/contrib/ruby/jasmine_runner.rb +++ b/contrib/ruby/jasmine_runner.rb @@ -186,6 +186,8 @@ module Jasmine @dir_mappings = dir_mappings @jasmine_files = jasmine_files @browser = options[:browser] || 'firefox' + @stylesheets = options[:stylesheets] || [] + @selenium_pid = nil @jasmine_server_pid = nil @@ -214,7 +216,7 @@ module Jasmine @jasmine_server_pid = fork do Process.setpgrp - Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files) + Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files, @stylesheets) exit! 0 end puts "jasmine server started. pid is #{@jasmine_server_pid}" diff --git a/doc/files.html b/doc/files.html index e2c07cb..85dfc0d 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index b31cb22..8be315d 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index 95ab2d1..7737952 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index e7536c2..6661b63 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 5a0113e..28aafee 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index 1c3ab1d..97439bb 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 505481e..b25fd0a 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 84abe18..8966bf0 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index 45b5260..ace6d85 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 31dd340..e360635 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 5974b47..4a36167 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index 235cd81..d41323b 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index 43a3c6d..75a503f 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 3064179..3f8d57f 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index 66bbe36..679cf42 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index a077a2a..b077621 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -529,7 +529,7 @@ 522 "major": 0, 523 "minor": 9, 524 "build": 0, -525 "revision": 1255469309 +525 "revision": 1255470394 526 }; 527 /** 528 * @namespace diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index 3e8825a..4d5e640 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -522,7 +522,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1255470394 + "revision": 1255472107 }; /** * @namespace From 706b180a2c9fa66a04b1319ea4d1d7686ee32810 Mon Sep 17 00:00:00 2001 From: Jared Grippe Date: Thu, 15 Oct 2009 17:43:33 -0700 Subject: [PATCH 12/18] fixed javascript syntax errors in README --- README.markdown | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.markdown b/README.markdown index 6a2466e..709f8f6 100644 --- a/README.markdown +++ b/README.markdown @@ -261,11 +261,11 @@ A suite can have a beforeEach declaration. It takes a function that is run befor beforeEach(function () { suiteWideFoo = 1; - } + }); it('should equal bar', function () { expect(suiteWideFoo).toEqual(1); - }; + }); }); A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example: @@ -280,11 +280,11 @@ A runner can also have beforeEach declarations. Runner beforeEach functions are beforeEach(function () { runnerWideFoo.push('suite'); - } + }); it('should equal bar', function () { expect(runnerWideFoo).toEqual(['runner', 'suite']); - }; + }); }); #### afterEach @@ -296,11 +296,11 @@ Similarly, there is an afterEach declaration. It takes a function that is run a var suiteWideFoo; afterEach(function () { suiteWideFoo = 0; - } + }); it('should equal 1', function () { expect(suiteWideFoo).toEqual(1); - }; + }); it('should equal 0 after', function () { expect(suiteWideFoo).toEqual(0); @@ -319,11 +319,11 @@ A runner can also have an afterEach declarations. Runner afterEach functions are afterEach(function () { runnerWideFoo.push('suite'); - } + }); it('should be empty', function () { expect(runnerWideFoo).toEqual([]); - }; + }); it('should be populated after', function () { expect(runnerWideFoo).toEqual(['suite', 'runner']); @@ -350,14 +350,14 @@ Jasmine supports nested describes. An example: it('nested expectation', function () { expect(suiteWideFoo).toEqual(0); expect(nestedSuiteBar).toEqual(1); - }; + }); }); it('top-level describe', function () { expect(suiteWideFoo).toEqual(0); expect(nestedSuiteBar).toEqual(undefined); - }; + }); }); ### Spies @@ -367,15 +367,15 @@ Jasmine integrates 'spies' that permit many spying, mocking, and faking behavior Here are a few examples: var Klass = function () { - } + }; var Klass.prototype.method = function (arg) { return arg; - } + }; var Klass.prototype.methodWithCallback = function (callback) { return callback('foo'); - } + }; ... From 85d3b2d14b0152c8e741f675b4a0b788d9535f06 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 17:48:28 -0700 Subject: [PATCH 13/18] IE7 fixes --- spec/suites/PrettyPrintSpec.js | 17 +++++++++++++--- src/PrettyPrinter.js | 2 +- src/base.js | 36 +++++++++++++++++++++------------- src/mock-timeout.js | 27 ++++++++++++++++++++----- 4 files changed, 59 insertions(+), 23 deletions(-) diff --git a/spec/suites/PrettyPrintSpec.js b/spec/suites/PrettyPrintSpec.js index 00559c0..48b1c7d 100644 --- a/spec/suites/PrettyPrintSpec.js +++ b/spec/suites/PrettyPrintSpec.js @@ -28,7 +28,8 @@ describe("jasmine.pp", function () { it("should stringify objects properly", function() { expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }"); expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }"); - expect(jasmine.pp({foo: function () { }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }"); + expect(jasmine.pp({foo: function () { + }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }"); }); it("should indicate circular object references", function() { @@ -39,8 +40,18 @@ describe("jasmine.pp", function () { it("should indicate getters on objects as such", function() { var sampleValue = {id: 1}; - sampleValue.__defineGetter__('calculatedValue', function() { throw new Error("don't call me!"); }); - expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : }"); + if (sampleValue.__defineGetter__) { + //not supported in IE! + sampleValue.__defineGetter__('calculatedValue', function() { + throw new Error("don't call me!"); + }); + } + if (sampleValue.__defineGetter__) { + expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : }"); + } + else { + expect(jasmine.pp(sampleValue)).toEqual("{ id : 1 }"); + } }); it("should stringify HTML nodes properly", function() { diff --git a/src/PrettyPrinter.js b/src/PrettyPrinter.js index ff793a9..d044753 100644 --- a/src/PrettyPrinter.js +++ b/src/PrettyPrinter.js @@ -56,7 +56,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { for (var property in obj) { if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__(property) != null); + fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false); } }; diff --git a/src/base.js b/src/base.js index 682438a..7448d42 100755 --- a/src/base.js +++ b/src/base.js @@ -1,6 +1,6 @@ /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. - * + * * @namespace */ var jasmine = {}; @@ -14,7 +14,7 @@ jasmine.unimplementedMethod_ = function() { /** * Large or small values here may result in slow test running & "Too much recursion" errors - * + * */ jasmine.UPDATE_INTERVAL = 250; @@ -29,7 +29,14 @@ jasmine.UPDATE_INTERVAL = 250; jasmine.bindOriginal_ = function(base, name) { var original = base[name]; return function() { - return original.apply(base, arguments); + if (original.apply) { + return original.apply(base, arguments); + } else { + //IE support + if (base == window) { + return window[name].apply(window, arguments); + } + } }; }; @@ -71,10 +78,10 @@ jasmine.getEnv = function() { */ jasmine.isArray_ = function(value) { return value && - typeof value === 'object' && - typeof value.length === 'number' && - typeof value.splice === 'function' && - !(value.propertyIsEnumerable('length')); + typeof value === 'object' && + typeof value.length === 'number' && + typeof value.splice === 'function' && + !(value.propertyIsEnumerable('length')); }; /** @@ -123,7 +130,7 @@ jasmine.any = function(clazz) { * Spies are torn down at the end of every spec. * * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. - * + * * @example * // a stub * var myStub = jasmine.createSpy('myStub'); // can be used anywhere @@ -168,7 +175,8 @@ jasmine.Spy = function(name) { /** * The acutal function this spy stubs. */ - this.plan = function() {}; + this.plan = function() { + }; /** * Tracking of the most recent call to the spy. * @example @@ -199,7 +207,7 @@ jasmine.Spy = function(name) { * var foo = { * bar: function() { // do some stuff } * } - * + * * // defining a spy on an existing property: foo.bar * spyOn(foo, 'bar').andCallThrough(); */ @@ -302,11 +310,11 @@ jasmine.createSpy = function(name) { }; var spy = new jasmine.Spy(name); - - for(var prop in spy) { + + for (var prop in spy) { spyObj[prop] = spy[prop]; } - + spyObj.reset(); return spyObj; @@ -410,7 +418,7 @@ var waits = function(timeout) { /** * Waits for the latchFunction to return true before proceeding to the next runs()-defined block. - * + * * @param {Number} timeout * @param {Function} latchFunction * @param {String} message diff --git a/src/mock-timeout.js b/src/mock-timeout.js index c959949..bec43ee 100755 --- a/src/mock-timeout.js +++ b/src/mock-timeout.js @@ -134,25 +134,42 @@ jasmine.Clock = { if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); } - }, + }, installed: null }; jasmine.Clock.installed = jasmine.Clock.real; +//else for IE support window.setTimeout = function(funcToCall, millis) { - return jasmine.Clock.installed.setTimeout.apply(this, arguments); + if (jasmine.Clock.installed.setTimeout.apply) { + return jasmine.Clock.installed.setTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.setTimeout(funcToCall, millis); + } }; window.setInterval = function(funcToCall, millis) { - return jasmine.Clock.installed.setInterval.apply(this, arguments); + if (jasmine.Clock.installed.setInterval.apply) { + return jasmine.Clock.installed.setInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.setInterval(funcToCall, millis); + } }; window.clearTimeout = function(timeoutKey) { - return jasmine.Clock.installed.clearTimeout.apply(this, arguments); + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearTimeout(timeoutKey); + } }; window.clearInterval = function(timeoutKey) { - return jasmine.Clock.installed.clearInterval.apply(this, arguments); + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearInterval(timeoutKey); + } }; From 35171c9222b4ebc4a3bfafe67e126b5d8429c06c Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 18:00:05 -0700 Subject: [PATCH 14/18] Rebuild jasmine.js --- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 2 +- lib/jasmine-0.9.0.js | 67 ++++++++++++++++------- 17 files changed, 62 insertions(+), 37 deletions(-) diff --git a/doc/files.html b/doc/files.html index 85dfc0d..e8c1783 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index 8be315d..e743417 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index 7737952..199cb75 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index 6661b63..e4eb3b7 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 28aafee..9f61e12 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index 97439bb..4c80855 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index b25fd0a..8b6b843 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 8966bf0..2f5b813 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index ace6d85..2c44e0f 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index e360635..002c34f 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 4a36167..75f0370 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index d41323b..a40031d 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index 75a503f..ddff33f 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 3f8d57f..89be636 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index 679cf42..c307aea 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Tue Oct 13 2009 15:15:06 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index b077621..b5d20e0 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -529,7 +529,7 @@ 522
"major": 0, 523 "minor": 9, 524 "build": 0, -525 "revision": 1255470394 +525 "revision": 1255472107 526 }; 527 /** 528 * @namespace diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index 4d5e640..70d7086 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -1,6 +1,6 @@ /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. - * + * * @namespace */ var jasmine = {}; @@ -14,7 +14,7 @@ jasmine.unimplementedMethod_ = function() { /** * Large or small values here may result in slow test running & "Too much recursion" errors - * + * */ jasmine.UPDATE_INTERVAL = 250; @@ -29,7 +29,14 @@ jasmine.UPDATE_INTERVAL = 250; jasmine.bindOriginal_ = function(base, name) { var original = base[name]; return function() { - return original.apply(base, arguments); + if (original.apply) { + return original.apply(base, arguments); + } else { + //IE support + if (base == window) { + return window[name].apply(window, arguments); + } + } }; }; @@ -71,10 +78,10 @@ jasmine.getEnv = function() { */ jasmine.isArray_ = function(value) { return value && - typeof value === 'object' && - typeof value.length === 'number' && - typeof value.splice === 'function' && - !(value.propertyIsEnumerable('length')); + typeof value === 'object' && + typeof value.length === 'number' && + typeof value.splice === 'function' && + !(value.propertyIsEnumerable('length')); }; /** @@ -123,7 +130,7 @@ jasmine.any = function(clazz) { * Spies are torn down at the end of every spec. * * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. - * + * * @example * // a stub * var myStub = jasmine.createSpy('myStub'); // can be used anywhere @@ -168,7 +175,8 @@ jasmine.Spy = function(name) { /** * The acutal function this spy stubs. */ - this.plan = function() {}; + this.plan = function() { + }; /** * Tracking of the most recent call to the spy. * @example @@ -199,7 +207,7 @@ jasmine.Spy = function(name) { * var foo = { * bar: function() { // do some stuff } * } - * + * * // defining a spy on an existing property: foo.bar * spyOn(foo, 'bar').andCallThrough(); */ @@ -302,11 +310,11 @@ jasmine.createSpy = function(name) { }; var spy = new jasmine.Spy(name); - - for(var prop in spy) { + + for (var prop in spy) { spyObj[prop] = spy[prop]; } - + spyObj.reset(); return spyObj; @@ -410,7 +418,7 @@ var waits = function(timeout) { /** * Waits for the latchFunction to return true before proceeding to the next runs()-defined block. - * + * * @param {Number} timeout * @param {Function} latchFunction * @param {String} message @@ -522,7 +530,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1255472107 + "revision": 1255654784 }; /** * @namespace @@ -1412,7 +1420,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) { jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { for (var property in obj) { if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__(property) != null); + fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false); } }; @@ -2146,25 +2154,42 @@ jasmine.Clock = { if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) { throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); } - }, + }, installed: null }; jasmine.Clock.installed = jasmine.Clock.real; +//else for IE support window.setTimeout = function(funcToCall, millis) { - return jasmine.Clock.installed.setTimeout.apply(this, arguments); + if (jasmine.Clock.installed.setTimeout.apply) { + return jasmine.Clock.installed.setTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.setTimeout(funcToCall, millis); + } }; window.setInterval = function(funcToCall, millis) { - return jasmine.Clock.installed.setInterval.apply(this, arguments); + if (jasmine.Clock.installed.setInterval.apply) { + return jasmine.Clock.installed.setInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.setInterval(funcToCall, millis); + } }; window.clearTimeout = function(timeoutKey) { - return jasmine.Clock.installed.clearTimeout.apply(this, arguments); + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearTimeout(timeoutKey); + } }; window.clearInterval = function(timeoutKey) { - return jasmine.Clock.installed.clearInterval.apply(this, arguments); + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearInterval(timeoutKey); + } }; From 308d02f72f36e0b1181119bf1e081a689c874c9d Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 18:58:52 -0700 Subject: [PATCH 15/18] Trivial Reporter improvements, runner now returns specs() --- contrib/ruby/run.html | 4 +- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_TrivialReporter.js.html | 145 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 4148 ++++++++++--------- lib/TrivialReporter.js | 15 +- lib/jasmine-0.9.0.js | 11 +- spec/suites/EnvSpec.js | 5 - spec/suites/RunnerSpec.js | 39 +- src/Runner.js | 9 + 23 files changed, 2249 insertions(+), 2157 deletions(-) diff --git a/contrib/ruby/run.html b/contrib/ruby/run.html index ec6e89f..676d75c 100644 --- a/contrib/ruby/run.html +++ b/contrib/ruby/run.html @@ -4,7 +4,7 @@ Jasmine suite <% css_files.each do |css_file| %> - + <% end %> <% jasmine_files.each do |jasmine_file| %> @@ -15,7 +15,7 @@ var jsApiReporter; (function() { var jasmineEnv = jasmine.getEnv(); - + jsApiReporter = new jasmine.JsApiReporter(); var trivialReporter = new jasmine.TrivialReporter(); diff --git a/doc/files.html b/doc/files.html index e8c1783..cdf93ee 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index e743417..8c42d87 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index 199cb75..be01800 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index e4eb3b7..1288870 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 9f61e12..5007a98 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index 4c80855..88f6187 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 8b6b843..8a223a4 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 2f5b813..33a4c8f 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index 2c44e0f..9934204 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 002c34f..8809683 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 75f0370..3175a60 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index a40031d..1fd20af 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index ddff33f..5d6f34a 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 89be636..fb0a17c 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index c307aea..e1b25d6 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 17:59:44 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_TrivialReporter.js.html b/doc/symbols/src/lib_TrivialReporter.js.html index 6835f5a..a3f7524 100644 --- a/doc/symbols/src/lib_TrivialReporter.js.html +++ b/doc/symbols/src/lib_TrivialReporter.js.html @@ -46,7 +46,7 @@ 39
var suite = suites[i]; 40 var suiteDiv = this.createDom('div', { className: 'suite' }, 41 this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - 42 suite.description); + 42 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); 43 this.suiteDivs[suite.getFullName()] = suiteDiv; 44 var parentDiv = this.document.body; 45 if (suite.parentSuite) { @@ -62,72 +62,79 @@ 55 var results = runner.results(); 56 var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; 57 this.runnerDiv.setAttribute("class", className); - 58 var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - 59 message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - 60 this.runnerMessageSpan.replaceChild(this.document.createTextNode(message), this.runnerMessageSpan.firstChild); - 61 }; - 62 - 63 jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - 64 var results = suite.results(); - 65 var status = results.passed() ? 'passed' : 'failed'; - 66 if (results.totalCount == 0) { // todo: change this to check results.skipped - 67 status = 'skipped'; - 68 } - 69 this.suiteDivs[suite.getFullName()].className += " " + status; - 70 }; - 71 - 72 jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - 73 var results = spec.results(); - 74 var status = results.passed() ? 'passed' : 'failed'; - 75 if (results.skipped) { - 76 status = 'skipped'; - 77 } - 78 var specDiv = this.createDom('div', { className: 'spec ' + status }, - 79 this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - 80 spec.getFullName()); - 81 - 82 - 83 var resultItems = results.getItems(); - 84 for (var i = 0; i < resultItems.length; i++) { - 85 var result = resultItems[i]; - 86 if (result.passed && !result.passed()) { - 87 var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'}); - 88 resultMessageDiv.innerHTML = result.message; // todo: lame; mend - 89 specDiv.appendChild(resultMessageDiv); - 90 specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); - 91 } - 92 } - 93 - 94 this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); - 95 }; - 96 - 97 jasmine.TrivialReporter.prototype.log = function() { - 98 console.log.apply(console, arguments); - 99 }; + 58 var specs = runner.specs(); + 59 var specCount = 0; + 60 for (var i = 0; i < specs.length; i++) { + 61 if (this.specFilter(specs[i])) { + 62 specCount++; + 63 } + 64 } + 65 var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); + 66 message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; + 67 this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); + 68 }; + 69 + 70 jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { + 71 var results = suite.results(); + 72 var status = results.passed() ? 'passed' : 'failed'; + 73 if (results.totalCount == 0) { // todo: change this to check results.skipped + 74 status = 'skipped'; + 75 } + 76 this.suiteDivs[suite.getFullName()].className += " " + status; + 77 }; + 78 + 79 jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { + 80 var results = spec.results(); + 81 var status = results.passed() ? 'passed' : 'failed'; + 82 if (results.skipped) { + 83 status = 'skipped'; + 84 } + 85 var specDiv = this.createDom('div', { className: 'spec ' + status }, + 86 this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), + 87 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName())); + 88 + 89 + 90 var resultItems = results.getItems(); + 91 for (var i = 0; i < resultItems.length; i++) { + 92 var result = resultItems[i]; + 93 if (result.passed && !result.passed()) { + 94 var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'}); + 95 resultMessageDiv.innerHTML = result.message; // todo: lame; mend + 96 specDiv.appendChild(resultMessageDiv); + 97 specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); + 98 } + 99 } 100 -101 jasmine.TrivialReporter.prototype.getLocation = function() { -102 return this.document.location; -103 }; -104 -105 jasmine.TrivialReporter.prototype.specFilter = function(spec) { -106 var paramMap = {}; -107 var params = this.getLocation().search.substring(1).split('&'); -108 for (var i = 0; i < params.length; i++) { -109 var p = params[i].split('='); -110 paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); -111 } -112 -113 if (!paramMap["spec"]) return true; -114 return spec.getFullName().indexOf(paramMap["spec"]) == 0; -115 }; -116 -117 //protect against console.log incidents -118 if (!("console" in window) || !("firebug" in console)) { -119 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; -120 window.console = {}; -121 for (var i = 0, len = names.length; i < len; ++i) { -122 window.console[names[i]] = function() { -123 }; -124 } -125 } -126 \ No newline at end of file +101 this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); +102 }; +103 +104 jasmine.TrivialReporter.prototype.log = function() { +105 console.log.apply(console, arguments); +106 }; +107 +108 jasmine.TrivialReporter.prototype.getLocation = function() { +109 return this.document.location; +110 }; +111 +112 jasmine.TrivialReporter.prototype.specFilter = function(spec) { +113 var paramMap = {}; +114 var params = this.getLocation().search.substring(1).split('&'); +115 for (var i = 0; i < params.length; i++) { +116 var p = params[i].split('='); +117 paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); +118 } +119 +120 if (!paramMap["spec"]) return true; +121 return spec.getFullName().indexOf(paramMap["spec"]) == 0; +122 }; +123 +124 //protect against console.log incidents +125 if (!("console" in window) || !("firebug" in console)) { +126 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; +127 window.console = {}; +128 for (var i = 0, len = names.length; i < len; ++i) { +129 window.console[names[i]] = function() { +130 }; +131 } +132 } +133 \ No newline at end of file diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index b5d20e0..cedc063 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -7,7 +7,7 @@ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
  1 /**
   2  * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
-  3  * 
+  3  *
   4  * @namespace
   5  */
   6 var jasmine = {};
@@ -21,7 +21,7 @@
  14 
  15 /**
  16  * Large or small values here may result in slow test running & "Too much recursion" errors
- 17  * 
+ 17  *
  18  */
  19 jasmine.UPDATE_INTERVAL = 250;
  20 
@@ -36,2143 +36,2177 @@
  29 jasmine.bindOriginal_ = function(base, name) {
  30   var original = base[name];
  31   return function() {
- 32     return original.apply(base, arguments);
- 33   };
- 34 };
- 35 
- 36 jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
- 37 jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
- 38 jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
- 39 jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
- 40 
- 41 jasmine.MessageResult = function(text) {
- 42   this.type = 'MessageResult';
- 43   this.text = text;
- 44   this.trace = new Error(); // todo: test better
- 45 };
- 46 
- 47 jasmine.ExpectationResult = function(passed, message, details) {
- 48   this.type = 'ExpectationResult';
- 49   this.passed_ = passed;
- 50   this.message = message;
- 51   this.details = details;
- 52   this.trace = new Error(message); // todo: test better
- 53 };
- 54 
- 55 jasmine.ExpectationResult.prototype.passed = function () {
- 56   return this.passed_;
- 57 };
- 58 
- 59 /**
- 60  * Getter for the Jasmine environment. Ensures one gets created
- 61  */
- 62 jasmine.getEnv = function() {
- 63   return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
+ 32     if (original.apply) {
+ 33       return original.apply(base, arguments);
+ 34     } else {
+ 35       //IE support
+ 36       if (base == window) {
+ 37         return window[name].apply(window, arguments);
+ 38       }
+ 39     }
+ 40   };
+ 41 };
+ 42 
+ 43 jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
+ 44 jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
+ 45 jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
+ 46 jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
+ 47 
+ 48 jasmine.MessageResult = function(text) {
+ 49   this.type = 'MessageResult';
+ 50   this.text = text;
+ 51   this.trace = new Error(); // todo: test better
+ 52 };
+ 53 
+ 54 jasmine.ExpectationResult = function(passed, message, details) {
+ 55   this.type = 'ExpectationResult';
+ 56   this.passed_ = passed;
+ 57   this.message = message;
+ 58   this.details = details;
+ 59   this.trace = new Error(message); // todo: test better
+ 60 };
+ 61 
+ 62 jasmine.ExpectationResult.prototype.passed = function () {
+ 63   return this.passed_;
  64 };
  65 
  66 /**
- 67  * @ignore
- 68  * @private
- 69  * @param value
- 70  * @returns {Boolean}
- 71  */
- 72 jasmine.isArray_ = function(value) {
- 73   return value &&
- 74   typeof value === 'object' &&
- 75   typeof value.length === 'number' &&
- 76   typeof value.splice === 'function' &&
- 77   !(value.propertyIsEnumerable('length'));
- 78 };
- 79 
- 80 /**
- 81  * Pretty printer for expecations.  Takes any object and turns it into a human-readable string.
- 82  *
- 83  * @param value {Object} an object to be outputted
- 84  * @returns {String}
- 85  */
- 86 jasmine.pp = function(value) {
- 87   var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
- 88   stringPrettyPrinter.format(value);
- 89   return stringPrettyPrinter.string;
- 90 };
- 91 
- 92 /**
- 93  * Returns true if the object is a DOM Node.
- 94  *
- 95  * @param {Object} obj object to check
- 96  * @returns {Boolean}
- 97  */
- 98 jasmine.isDomNode = function(obj) {
- 99   return obj['nodeType'] > 0;
-100 };
-101 
-102 /**
-103  * Returns a matchable 'generic' object of the class type.  For use in expecations of type when values don't matter.
-104  *
-105  * @example
-106  * // don't care about which function is passed in, as long as it's a function
-107  * expect(mySpy).wasCalledWith(jasmine.any(Function));
-108  *
-109  * @param {Class} clazz
-110  * @returns matchable object of the type clazz
-111  */
-112 jasmine.any = function(clazz) {
-113   return new jasmine.Matchers.Any(clazz);
-114 };
-115 
-116 /**
-117  * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
-118  *
-119  * Spies should be created in test setup, before expectations.  They can then be checked, using the standard Jasmine
-120  * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
-121  *
-122  * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
-123  * Spies are torn down at the end of every spec.
-124  *
-125  * Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
-126  * 
-127  * @example
-128  * // a stub
-129  * var myStub = jasmine.createSpy('myStub');  // can be used anywhere
-130  *
-131  * // spy example
-132  * var foo = {
-133  *   not: function(bool) { return !bool; }
-134  * }
-135  *
-136  * // actual foo.not will not be called, execution stops
-137  * spyOn(foo, 'not');
-138 
-139  // foo.not spied upon, execution will continue to implementation
-140  * spyOn(foo, 'not').andCallThrough();
-141  *
-142  * // fake example
-143  * var foo = {
-144  *   not: function(bool) { return !bool; }
-145  * }
-146  *
-147  * // foo.not(val) will return val
-148  * spyOn(foo, 'not').andCallFake(function(value) {return value;});
-149  *
-150  * // mock example
-151  * foo.not(7 == 7);
-152  * expect(foo.not).wasCalled();
-153  * expect(foo.not).wasCalledWith(true);
-154  *
-155  * @constructor
-156  * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
-157  * @param {String} name
-158  */
-159 jasmine.Spy = function(name) {
-160   /**
-161    * The name of the spy, if provided.
-162    */
-163   this.identity = name || 'unknown';
-164   /**
-165    *  Is this Object a spy?
-166    */
-167   this.isSpy = true;
-168   /**
-169    * The acutal function this spy stubs.
-170    */
-171   this.plan = function() {};
-172   /**
-173    * Tracking of the most recent call to the spy.
-174    * @example
-175    * var mySpy = jasmine.createSpy('foo');
-176    * mySpy(1, 2);
-177    * mySpy.mostRecentCall.args = [1, 2];
-178    */
-179   this.mostRecentCall = {};
-180 
-181   /**
-182    * Holds arguments for each call to the spy, indexed by call count
-183    * @example
-184    * var mySpy = jasmine.createSpy('foo');
-185    * mySpy(1, 2);
-186    * mySpy(7, 8);
-187    * mySpy.mostRecentCall.args = [7, 8];
-188    * mySpy.argsForCall[0] = [1, 2];
-189    * mySpy.argsForCall[1] = [7, 8];
-190    */
-191   this.argsForCall = [];
-192   this.calls = [];
-193 };
-194 
-195 /**
-196  * Tells a spy to call through to the actual implemenatation.
-197  *
-198  * @example
-199  * var foo = {
-200  *   bar: function() { // do some stuff }
-201  * }
-202  * 
-203  * // defining a spy on an existing property: foo.bar
-204  * spyOn(foo, 'bar').andCallThrough();
-205  */
-206 jasmine.Spy.prototype.andCallThrough = function() {
-207   this.plan = this.originalValue;
-208   return this;
-209 };
-210 
-211 /**
-212  * For setting the return value of a spy.
-213  *
-214  * @example
-215  * // defining a spy from scratch: foo() returns 'baz'
-216  * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
-217  *
-218  * // defining a spy on an existing property: foo.bar() returns 'baz'
-219  * spyOn(foo, 'bar').andReturn('baz');
-220  *
-221  * @param {Object} value
-222  */
-223 jasmine.Spy.prototype.andReturn = function(value) {
-224   this.plan = function() {
-225     return value;
-226   };
-227   return this;
-228 };
-229 
-230 /**
-231  * For throwing an exception when a spy is called.
-232  *
-233  * @example
-234  * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
-235  * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
-236  *
-237  * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
-238  * spyOn(foo, 'bar').andThrow('baz');
-239  *
-240  * @param {String} exceptionMsg
-241  */
-242 jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
-243   this.plan = function() {
-244     throw exceptionMsg;
-245   };
-246   return this;
-247 };
-248 
-249 /**
-250  * Calls an alternate implementation when a spy is called.
-251  *
-252  * @example
-253  * var baz = function() {
-254  *   // do some stuff, return something
-255  * }
-256  * // defining a spy from scratch: foo() calls the function baz
-257  * var foo = jasmine.createSpy('spy on foo').andCall(baz);
-258  *
-259  * // defining a spy on an existing property: foo.bar() calls an anonymnous function
-260  * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
-261  *
-262  * @param {Function} fakeFunc
-263  */
-264 jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
-265   this.plan = fakeFunc;
-266   return this;
-267 };
-268 
-269 /**
-270  * Resets all of a spy's the tracking variables so that it can be used again.
-271  *
-272  * @example
-273  * spyOn(foo, 'bar');
-274  *
-275  * foo.bar();
-276  *
-277  * expect(foo.bar.callCount).toEqual(1);
-278  *
-279  * foo.bar.reset();
-280  *
-281  * expect(foo.bar.callCount).toEqual(0);
-282  */
-283 jasmine.Spy.prototype.reset = function() {
-284   this.wasCalled = false;
-285   this.callCount = 0;
-286   this.argsForCall = [];
-287   this.calls = [];
-288   this.mostRecentCall = {};
-289 };
-290 
-291 jasmine.createSpy = function(name) {
-292 
-293   var spyObj = function() {
-294     spyObj.wasCalled = true;
-295     spyObj.callCount++;
-296     var args = jasmine.util.argsToArray(arguments);
-297     spyObj.mostRecentCall.object = this;
-298     spyObj.mostRecentCall.args = args;
-299     spyObj.argsForCall.push(args);
-300     spyObj.calls.push({object: this, args: args});
-301     return spyObj.plan.apply(this, arguments);
-302   };
-303 
-304   var spy = new jasmine.Spy(name);
-305   
-306   for(var prop in spy) {
-307     spyObj[prop] = spy[prop];
-308   }
-309   
-310   spyObj.reset();
+ 67  * Getter for the Jasmine environment. Ensures one gets created
+ 68  */
+ 69 jasmine.getEnv = function() {
+ 70   return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
+ 71 };
+ 72 
+ 73 /**
+ 74  * @ignore
+ 75  * @private
+ 76  * @param value
+ 77  * @returns {Boolean}
+ 78  */
+ 79 jasmine.isArray_ = function(value) {
+ 80   return value &&
+ 81          typeof value === 'object' &&
+ 82          typeof value.length === 'number' &&
+ 83          typeof value.splice === 'function' &&
+ 84          !(value.propertyIsEnumerable('length'));
+ 85 };
+ 86 
+ 87 /**
+ 88  * Pretty printer for expecations.  Takes any object and turns it into a human-readable string.
+ 89  *
+ 90  * @param value {Object} an object to be outputted
+ 91  * @returns {String}
+ 92  */
+ 93 jasmine.pp = function(value) {
+ 94   var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
+ 95   stringPrettyPrinter.format(value);
+ 96   return stringPrettyPrinter.string;
+ 97 };
+ 98 
+ 99 /**
+100  * Returns true if the object is a DOM Node.
+101  *
+102  * @param {Object} obj object to check
+103  * @returns {Boolean}
+104  */
+105 jasmine.isDomNode = function(obj) {
+106   return obj['nodeType'] > 0;
+107 };
+108 
+109 /**
+110  * Returns a matchable 'generic' object of the class type.  For use in expecations of type when values don't matter.
+111  *
+112  * @example
+113  * // don't care about which function is passed in, as long as it's a function
+114  * expect(mySpy).wasCalledWith(jasmine.any(Function));
+115  *
+116  * @param {Class} clazz
+117  * @returns matchable object of the type clazz
+118  */
+119 jasmine.any = function(clazz) {
+120   return new jasmine.Matchers.Any(clazz);
+121 };
+122 
+123 /**
+124  * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
+125  *
+126  * Spies should be created in test setup, before expectations.  They can then be checked, using the standard Jasmine
+127  * expectation syntax. Spies can be checked if they were called or not and what the calling params were.
+128  *
+129  * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
+130  * Spies are torn down at the end of every spec.
+131  *
+132  * Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
+133  *
+134  * @example
+135  * // a stub
+136  * var myStub = jasmine.createSpy('myStub');  // can be used anywhere
+137  *
+138  * // spy example
+139  * var foo = {
+140  *   not: function(bool) { return !bool; }
+141  * }
+142  *
+143  * // actual foo.not will not be called, execution stops
+144  * spyOn(foo, 'not');
+145 
+146  // foo.not spied upon, execution will continue to implementation
+147  * spyOn(foo, 'not').andCallThrough();
+148  *
+149  * // fake example
+150  * var foo = {
+151  *   not: function(bool) { return !bool; }
+152  * }
+153  *
+154  * // foo.not(val) will return val
+155  * spyOn(foo, 'not').andCallFake(function(value) {return value;});
+156  *
+157  * // mock example
+158  * foo.not(7 == 7);
+159  * expect(foo.not).wasCalled();
+160  * expect(foo.not).wasCalledWith(true);
+161  *
+162  * @constructor
+163  * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
+164  * @param {String} name
+165  */
+166 jasmine.Spy = function(name) {
+167   /**
+168    * The name of the spy, if provided.
+169    */
+170   this.identity = name || 'unknown';
+171   /**
+172    *  Is this Object a spy?
+173    */
+174   this.isSpy = true;
+175   /**
+176    * The acutal function this spy stubs.
+177    */
+178   this.plan = function() {
+179   };
+180   /**
+181    * Tracking of the most recent call to the spy.
+182    * @example
+183    * var mySpy = jasmine.createSpy('foo');
+184    * mySpy(1, 2);
+185    * mySpy.mostRecentCall.args = [1, 2];
+186    */
+187   this.mostRecentCall = {};
+188 
+189   /**
+190    * Holds arguments for each call to the spy, indexed by call count
+191    * @example
+192    * var mySpy = jasmine.createSpy('foo');
+193    * mySpy(1, 2);
+194    * mySpy(7, 8);
+195    * mySpy.mostRecentCall.args = [7, 8];
+196    * mySpy.argsForCall[0] = [1, 2];
+197    * mySpy.argsForCall[1] = [7, 8];
+198    */
+199   this.argsForCall = [];
+200   this.calls = [];
+201 };
+202 
+203 /**
+204  * Tells a spy to call through to the actual implemenatation.
+205  *
+206  * @example
+207  * var foo = {
+208  *   bar: function() { // do some stuff }
+209  * }
+210  *
+211  * // defining a spy on an existing property: foo.bar
+212  * spyOn(foo, 'bar').andCallThrough();
+213  */
+214 jasmine.Spy.prototype.andCallThrough = function() {
+215   this.plan = this.originalValue;
+216   return this;
+217 };
+218 
+219 /**
+220  * For setting the return value of a spy.
+221  *
+222  * @example
+223  * // defining a spy from scratch: foo() returns 'baz'
+224  * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
+225  *
+226  * // defining a spy on an existing property: foo.bar() returns 'baz'
+227  * spyOn(foo, 'bar').andReturn('baz');
+228  *
+229  * @param {Object} value
+230  */
+231 jasmine.Spy.prototype.andReturn = function(value) {
+232   this.plan = function() {
+233     return value;
+234   };
+235   return this;
+236 };
+237 
+238 /**
+239  * For throwing an exception when a spy is called.
+240  *
+241  * @example
+242  * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
+243  * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
+244  *
+245  * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
+246  * spyOn(foo, 'bar').andThrow('baz');
+247  *
+248  * @param {String} exceptionMsg
+249  */
+250 jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
+251   this.plan = function() {
+252     throw exceptionMsg;
+253   };
+254   return this;
+255 };
+256 
+257 /**
+258  * Calls an alternate implementation when a spy is called.
+259  *
+260  * @example
+261  * var baz = function() {
+262  *   // do some stuff, return something
+263  * }
+264  * // defining a spy from scratch: foo() calls the function baz
+265  * var foo = jasmine.createSpy('spy on foo').andCall(baz);
+266  *
+267  * // defining a spy on an existing property: foo.bar() calls an anonymnous function
+268  * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
+269  *
+270  * @param {Function} fakeFunc
+271  */
+272 jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
+273   this.plan = fakeFunc;
+274   return this;
+275 };
+276 
+277 /**
+278  * Resets all of a spy's the tracking variables so that it can be used again.
+279  *
+280  * @example
+281  * spyOn(foo, 'bar');
+282  *
+283  * foo.bar();
+284  *
+285  * expect(foo.bar.callCount).toEqual(1);
+286  *
+287  * foo.bar.reset();
+288  *
+289  * expect(foo.bar.callCount).toEqual(0);
+290  */
+291 jasmine.Spy.prototype.reset = function() {
+292   this.wasCalled = false;
+293   this.callCount = 0;
+294   this.argsForCall = [];
+295   this.calls = [];
+296   this.mostRecentCall = {};
+297 };
+298 
+299 jasmine.createSpy = function(name) {
+300 
+301   var spyObj = function() {
+302     spyObj.wasCalled = true;
+303     spyObj.callCount++;
+304     var args = jasmine.util.argsToArray(arguments);
+305     spyObj.mostRecentCall.object = this;
+306     spyObj.mostRecentCall.args = args;
+307     spyObj.argsForCall.push(args);
+308     spyObj.calls.push({object: this, args: args});
+309     return spyObj.plan.apply(this, arguments);
+310   };
 311 
-312   return spyObj;
-313 };
-314 
-315 /**
-316  * Creates a more complicated spy: an Object that has every property a function that is a spy.  Used for stubbing something
-317  * large in one call.
-318  *
-319  * @param {String} baseName name of spy class
-320  * @param {Array} methodNames array of names of methods to make spies
-321  */
-322 jasmine.createSpyObj = function(baseName, methodNames) {
-323   var obj = {};
-324   for (var i = 0; i < methodNames.length; i++) {
-325     obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
-326   }
-327   return obj;
-328 };
-329 
-330 jasmine.log = function(message) {
-331   jasmine.getEnv().currentSpec.log(message);
-332 };
-333 
-334 /**
-335  * Function that installs a spy on an existing object's method name.  Used within a Spec to create a spy.
-336  *
-337  * @example
-338  * // spy example
-339  * var foo = {
-340  *   not: function(bool) { return !bool; }
-341  * }
-342  * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
-343  *
-344  * @see jasmine.createSpy
-345  * @param obj
-346  * @param methodName
-347  * @returns a Jasmine spy that can be chained with all spy methods
-348  */
-349 var spyOn = function(obj, methodName) {
-350   return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
-351 };
-352 
-353 /**
-354  * Creates a Jasmine spec that will be added to the current suite.
-355  *
-356  * // TODO: pending tests
-357  *
-358  * @example
-359  * it('should be true', function() {
-360  *   expect(true).toEqual(true);
-361  * });
-362  *
-363  * @param {String} desc description of this specification
-364  * @param {Function} func defines the preconditions and expectations of the spec
-365  */
-366 var it = function(desc, func) {
-367   return jasmine.getEnv().it(desc, func);
-368 };
-369 
-370 /**
-371  * Creates a <em>disabled</em> Jasmine spec.
-372  *
-373  * A convenience method that allows existing specs to be disabled temporarily during development.
-374  *
-375  * @param {String} desc description of this specification
-376  * @param {Function} func defines the preconditions and expectations of the spec
-377  */
-378 var xit = function(desc, func) {
-379   return jasmine.getEnv().xit(desc, func);
-380 };
-381 
-382 /**
-383  * Starts a chain for a Jasmine expectation.
-384  *
-385  * It is passed an Object that is the actual value and should chain to one of the many
-386  * jasmine.Matchers functions.
-387  *
-388  * @param {Object} actual Actual value to test against and expected value
-389  */
-390 var expect = function(actual) {
-391   return jasmine.getEnv().currentSpec.expect(actual);
-392 };
-393 
-394 /**
-395  * Defines part of a jasmine spec.  Used in cominbination with waits or waitsFor in asynchrnous specs.
-396  *
-397  * @param {Function} func Function that defines part of a jasmine spec.
-398  */
-399 var runs = function(func) {
-400   jasmine.getEnv().currentSpec.runs(func);
-401 };
-402 
-403 /**
-404  * Waits for a timeout before moving to the next runs()-defined block.
-405  * @param {Number} timeout
+312   var spy = new jasmine.Spy(name);
+313 
+314   for (var prop in spy) {
+315     spyObj[prop] = spy[prop];
+316   }
+317 
+318   spyObj.reset();
+319 
+320   return spyObj;
+321 };
+322 
+323 /**
+324  * Creates a more complicated spy: an Object that has every property a function that is a spy.  Used for stubbing something
+325  * large in one call.
+326  *
+327  * @param {String} baseName name of spy class
+328  * @param {Array} methodNames array of names of methods to make spies
+329  */
+330 jasmine.createSpyObj = function(baseName, methodNames) {
+331   var obj = {};
+332   for (var i = 0; i < methodNames.length; i++) {
+333     obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
+334   }
+335   return obj;
+336 };
+337 
+338 jasmine.log = function(message) {
+339   jasmine.getEnv().currentSpec.log(message);
+340 };
+341 
+342 /**
+343  * Function that installs a spy on an existing object's method name.  Used within a Spec to create a spy.
+344  *
+345  * @example
+346  * // spy example
+347  * var foo = {
+348  *   not: function(bool) { return !bool; }
+349  * }
+350  * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
+351  *
+352  * @see jasmine.createSpy
+353  * @param obj
+354  * @param methodName
+355  * @returns a Jasmine spy that can be chained with all spy methods
+356  */
+357 var spyOn = function(obj, methodName) {
+358   return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
+359 };
+360 
+361 /**
+362  * Creates a Jasmine spec that will be added to the current suite.
+363  *
+364  * // TODO: pending tests
+365  *
+366  * @example
+367  * it('should be true', function() {
+368  *   expect(true).toEqual(true);
+369  * });
+370  *
+371  * @param {String} desc description of this specification
+372  * @param {Function} func defines the preconditions and expectations of the spec
+373  */
+374 var it = function(desc, func) {
+375   return jasmine.getEnv().it(desc, func);
+376 };
+377 
+378 /**
+379  * Creates a <em>disabled</em> Jasmine spec.
+380  *
+381  * A convenience method that allows existing specs to be disabled temporarily during development.
+382  *
+383  * @param {String} desc description of this specification
+384  * @param {Function} func defines the preconditions and expectations of the spec
+385  */
+386 var xit = function(desc, func) {
+387   return jasmine.getEnv().xit(desc, func);
+388 };
+389 
+390 /**
+391  * Starts a chain for a Jasmine expectation.
+392  *
+393  * It is passed an Object that is the actual value and should chain to one of the many
+394  * jasmine.Matchers functions.
+395  *
+396  * @param {Object} actual Actual value to test against and expected value
+397  */
+398 var expect = function(actual) {
+399   return jasmine.getEnv().currentSpec.expect(actual);
+400 };
+401 
+402 /**
+403  * Defines part of a jasmine spec.  Used in cominbination with waits or waitsFor in asynchrnous specs.
+404  *
+405  * @param {Function} func Function that defines part of a jasmine spec.
 406  */
-407 var waits = function(timeout) {
-408   jasmine.getEnv().currentSpec.waits(timeout);
+407 var runs = function(func) {
+408   jasmine.getEnv().currentSpec.runs(func);
 409 };
 410 
 411 /**
-412  * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
-413  *  
-414  * @param {Number} timeout
-415  * @param {Function} latchFunction
-416  * @param {String} message
-417  */
-418 var waitsFor = function(timeout, latchFunction, message) {
-419   jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
-420 };
-421 
-422 /**
-423  * A function that is called before each spec in a suite.
-424  *
-425  * Used for spec setup, including validating assumptions.
-426  *
-427  * @param {Function} beforeEachFunction
-428  */
-429 var beforeEach = function(beforeEachFunction) {
-430   jasmine.getEnv().beforeEach(beforeEachFunction);
-431 };
-432 
-433 /**
-434  * A function that is called after each spec in a suite.
-435  *
-436  * Used for restoring any state that is hijacked during spec execution.
-437  *
-438  * @param {Function} afterEachFunction
-439  */
-440 var afterEach = function(afterEachFunction) {
-441   jasmine.getEnv().afterEach(afterEachFunction);
-442 };
-443 
-444 /**
-445  * Defines a suite of specifications.
-446  *
-447  * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
-448  * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
-449  * of setup in some tests.
-450  *
-451  * @example
-452  * // TODO: a simple suite
-453  *
-454  * // TODO: a simple suite with a nested describe block
-455  *
-456  * @param {String} description A string, usually the class under test.
-457  * @param {Function} specDefinitions function that defines several specs.
-458  */
-459 var describe = function(description, specDefinitions) {
-460   return jasmine.getEnv().describe(description, specDefinitions);
-461 };
-462 
-463 /**
-464  * Disables a suite of specifications.  Used to disable some suites in a file, or files, temporarily during development.
-465  *
-466  * @param {String} description A string, usually the class under test.
-467  * @param {Function} specDefinitions function that defines several specs.
-468  */
-469 var xdescribe = function(description, specDefinitions) {
-470   return jasmine.getEnv().xdescribe(description, specDefinitions);
-471 };
-472 
-473 
-474 jasmine.XmlHttpRequest = XMLHttpRequest;
-475 
-476 // Provide the XMLHttpRequest class for IE 5.x-6.x:
-477 if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
-478   try {
-479     return new ActiveXObject("Msxml2.XMLHTTP.6.0");
-480   } catch(e) {
-481   }
-482   try {
-483     return new ActiveXObject("Msxml2.XMLHTTP.3.0");
-484   } catch(e) {
-485   }
+412  * Waits for a timeout before moving to the next runs()-defined block.
+413  * @param {Number} timeout
+414  */
+415 var waits = function(timeout) {
+416   jasmine.getEnv().currentSpec.waits(timeout);
+417 };
+418 
+419 /**
+420  * Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
+421  *
+422  * @param {Number} timeout
+423  * @param {Function} latchFunction
+424  * @param {String} message
+425  */
+426 var waitsFor = function(timeout, latchFunction, message) {
+427   jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
+428 };
+429 
+430 /**
+431  * A function that is called before each spec in a suite.
+432  *
+433  * Used for spec setup, including validating assumptions.
+434  *
+435  * @param {Function} beforeEachFunction
+436  */
+437 var beforeEach = function(beforeEachFunction) {
+438   jasmine.getEnv().beforeEach(beforeEachFunction);
+439 };
+440 
+441 /**
+442  * A function that is called after each spec in a suite.
+443  *
+444  * Used for restoring any state that is hijacked during spec execution.
+445  *
+446  * @param {Function} afterEachFunction
+447  */
+448 var afterEach = function(afterEachFunction) {
+449   jasmine.getEnv().afterEach(afterEachFunction);
+450 };
+451 
+452 /**
+453  * Defines a suite of specifications.
+454  *
+455  * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
+456  * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
+457  * of setup in some tests.
+458  *
+459  * @example
+460  * // TODO: a simple suite
+461  *
+462  * // TODO: a simple suite with a nested describe block
+463  *
+464  * @param {String} description A string, usually the class under test.
+465  * @param {Function} specDefinitions function that defines several specs.
+466  */
+467 var describe = function(description, specDefinitions) {
+468   return jasmine.getEnv().describe(description, specDefinitions);
+469 };
+470 
+471 /**
+472  * Disables a suite of specifications.  Used to disable some suites in a file, or files, temporarily during development.
+473  *
+474  * @param {String} description A string, usually the class under test.
+475  * @param {Function} specDefinitions function that defines several specs.
+476  */
+477 var xdescribe = function(description, specDefinitions) {
+478   return jasmine.getEnv().xdescribe(description, specDefinitions);
+479 };
+480 
+481 
+482 jasmine.XmlHttpRequest = XMLHttpRequest;
+483 
+484 // Provide the XMLHttpRequest class for IE 5.x-6.x:
+485 if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
 486   try {
-487     return new ActiveXObject("Msxml2.XMLHTTP");
+487     return new ActiveXObject("Msxml2.XMLHTTP.6.0");
 488   } catch(e) {
 489   }
 490   try {
-491     return new ActiveXObject("Microsoft.XMLHTTP");
+491     return new ActiveXObject("Msxml2.XMLHTTP.3.0");
 492   } catch(e) {
 493   }
-494   throw new Error("This browser does not support XMLHttpRequest.");
-495 };
-496 
-497 /**
-498  * Adds suite files to an HTML document so that they are executed, thus adding them to the current
-499  * Jasmine environment.
-500  *
-501  * @param {String} url path to the file to include
-502  * @param {Boolean} opt_global
-503  */
-504 jasmine.include = function(url, opt_global) {
-505   if (opt_global) {
-506     document.write('<script type="text/javascript" src="' + url + '"></' + 'script>');
-507   } else {
-508     var xhr;
-509     try {
-510       xhr = new jasmine.XmlHttpRequest();
-511       xhr.open("GET", url, false);
-512       xhr.send(null);
-513     } catch(e) {
-514       throw new Error("couldn't fetch " + url + ": " + e);
-515     }
-516 
-517     return eval(xhr.responseText);
-518   }
-519 };
-520 
-521 jasmine.version_= {
-522   "major": 0,
-523   "minor": 9,
-524   "build": 0,
-525   "revision": 1255472107
-526   };
-527 /**
-528  * @namespace
-529  */
-530 jasmine.util = {};
-531 
-532 /**
-533  * Declare that a child class inherite it's prototype from the parent class.
-534  *
-535  * @private
-536  * @param {Function} childClass
-537  * @param {Function} parentClass
-538  */
-539 jasmine.util.inherit = function(childClass, parentClass) {
-540   var subclass = function() {
-541   };
-542   subclass.prototype = parentClass.prototype;
-543   childClass.prototype = new subclass;
-544 };
-545 
-546 jasmine.util.formatException = function(e) {
-547   var lineNumber;
-548   if (e.line) {
-549     lineNumber = e.line;
-550   }
-551   else if (e.lineNumber) {
-552     lineNumber = e.lineNumber;
-553   }
-554 
-555   var file;
-556 
-557   if (e.sourceURL) {
-558     file = e.sourceURL;
-559   }
-560   else if (e.fileName) {
-561     file = e.fileName;
-562   }
-563 
-564   var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
-565 
-566   if (file && lineNumber) {
-567     message += ' in ' + file + ' (line ' + lineNumber + ')';
-568   }
-569 
-570   return message;
-571 };
-572 
-573 jasmine.util.htmlEscape = function(str) {
-574   if (!str) return str;
-575   return str.replace(/&/g, '&')
-576     .replace(/</g, '<')
-577     .replace(/>/g, '>');
-578 };
-579 
-580 jasmine.util.argsToArray = function(args) {
-581   var arrayOfArgs = [];
-582   for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
-583   return arrayOfArgs;
-584 };
-585 
-586 /**
-587  * Environment for Jasmine
-588  *
-589  * @constructor
-590  */
-591 jasmine.Env = function() {
-592   this.currentSpec = null;
-593   this.currentSuite = null;
-594   this.currentRunner_ = new jasmine.Runner(this);
-595   this.currentlyRunningTests = false;
-596 
-597   this.reporter = new jasmine.MultiReporter();
-598 
-599   this.updateInterval = jasmine.UPDATE_INTERVAL
-600   this.lastUpdate = 0;
-601   this.specFilter = function() {
-602     return true;
-603   };
+494   try {
+495     return new ActiveXObject("Msxml2.XMLHTTP");
+496   } catch(e) {
+497   }
+498   try {
+499     return new ActiveXObject("Microsoft.XMLHTTP");
+500   } catch(e) {
+501   }
+502   throw new Error("This browser does not support XMLHttpRequest.");
+503 };
+504 
+505 /**
+506  * Adds suite files to an HTML document so that they are executed, thus adding them to the current
+507  * Jasmine environment.
+508  *
+509  * @param {String} url path to the file to include
+510  * @param {Boolean} opt_global
+511  */
+512 jasmine.include = function(url, opt_global) {
+513   if (opt_global) {
+514     document.write('<script type="text/javascript" src="' + url + '"></' + 'script>');
+515   } else {
+516     var xhr;
+517     try {
+518       xhr = new jasmine.XmlHttpRequest();
+519       xhr.open("GET", url, false);
+520       xhr.send(null);
+521     } catch(e) {
+522       throw new Error("couldn't fetch " + url + ": " + e);
+523     }
+524 
+525     return eval(xhr.responseText);
+526   }
+527 };
+528 
+529 jasmine.version_= {
+530   "major": 0,
+531   "minor": 9,
+532   "build": 0,
+533   "revision": 1255657888
+534   };
+535 /**
+536  * @namespace
+537  */
+538 jasmine.util = {};
+539 
+540 /**
+541  * Declare that a child class inherite it's prototype from the parent class.
+542  *
+543  * @private
+544  * @param {Function} childClass
+545  * @param {Function} parentClass
+546  */
+547 jasmine.util.inherit = function(childClass, parentClass) {
+548   var subclass = function() {
+549   };
+550   subclass.prototype = parentClass.prototype;
+551   childClass.prototype = new subclass;
+552 };
+553 
+554 jasmine.util.formatException = function(e) {
+555   var lineNumber;
+556   if (e.line) {
+557     lineNumber = e.line;
+558   }
+559   else if (e.lineNumber) {
+560     lineNumber = e.lineNumber;
+561   }
+562 
+563   var file;
+564 
+565   if (e.sourceURL) {
+566     file = e.sourceURL;
+567   }
+568   else if (e.fileName) {
+569     file = e.fileName;
+570   }
+571 
+572   var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
+573 
+574   if (file && lineNumber) {
+575     message += ' in ' + file + ' (line ' + lineNumber + ')';
+576   }
+577 
+578   return message;
+579 };
+580 
+581 jasmine.util.htmlEscape = function(str) {
+582   if (!str) return str;
+583   return str.replace(/&/g, '&')
+584     .replace(/</g, '<')
+585     .replace(/>/g, '>');
+586 };
+587 
+588 jasmine.util.argsToArray = function(args) {
+589   var arrayOfArgs = [];
+590   for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
+591   return arrayOfArgs;
+592 };
+593 
+594 /**
+595  * Environment for Jasmine
+596  *
+597  * @constructor
+598  */
+599 jasmine.Env = function() {
+600   this.currentSpec = null;
+601   this.currentSuite = null;
+602   this.currentRunner_ = new jasmine.Runner(this);
+603   this.currentlyRunningTests = false;
 604 
-605   this.nextSpecId_ = 0;
-606   this.nextSuiteId_ = 0;
-607   this.equalityTesters_ = [];
-608 };
-609 
-610 
-611 jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
-612 jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
-613 jasmine.Env.prototype.setInterval = jasmine.setInterval;
-614 jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
-615 
-616 /**
-617  * @returns an object containing jasmine version build info, if set.
-618  */
-619 jasmine.Env.prototype.version = function () {
-620   if (jasmine.version_) {
-621     return jasmine.version_;
-622   } else {
-623     throw new Error('Version not set');
-624   }
-625 };
-626 
-627 /**
-628  * @returns a sequential integer starting at 0
-629  */
-630 jasmine.Env.prototype.nextSpecId = function () {
-631   return this.nextSpecId_++;
-632 };
-633 
-634 /**
-635  * @returns a sequential integer starting at 0
-636  */
-637 jasmine.Env.prototype.nextSuiteId = function () {
-638   return this.nextSuiteId_++;
-639 };
-640 
-641 /**
-642  * Register a reporter to receive status updates from Jasmine.
-643  * @param {jasmine.Reporter} reporter An object which will receive status updates.
+605   this.reporter = new jasmine.MultiReporter();
+606 
+607   this.updateInterval = jasmine.UPDATE_INTERVAL
+608   this.lastUpdate = 0;
+609   this.specFilter = function() {
+610     return true;
+611   };
+612 
+613   this.nextSpecId_ = 0;
+614   this.nextSuiteId_ = 0;
+615   this.equalityTesters_ = [];
+616 };
+617 
+618 
+619 jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
+620 jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
+621 jasmine.Env.prototype.setInterval = jasmine.setInterval;
+622 jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
+623 
+624 /**
+625  * @returns an object containing jasmine version build info, if set.
+626  */
+627 jasmine.Env.prototype.version = function () {
+628   if (jasmine.version_) {
+629     return jasmine.version_;
+630   } else {
+631     throw new Error('Version not set');
+632   }
+633 };
+634 
+635 /**
+636  * @returns a sequential integer starting at 0
+637  */
+638 jasmine.Env.prototype.nextSpecId = function () {
+639   return this.nextSpecId_++;
+640 };
+641 
+642 /**
+643  * @returns a sequential integer starting at 0
 644  */
-645 jasmine.Env.prototype.addReporter = function(reporter) {
-646   this.reporter.addReporter(reporter);
+645 jasmine.Env.prototype.nextSuiteId = function () {
+646   return this.nextSuiteId_++;
 647 };
 648 
-649 jasmine.Env.prototype.execute = function() {
-650   this.currentRunner_.execute();
-651 };
-652 
-653 jasmine.Env.prototype.describe = function(description, specDefinitions) {
-654   var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
-655 
-656   var parentSuite = this.currentSuite;
-657   if (parentSuite) {
-658     parentSuite.add(suite);
-659   } else {
-660     this.currentRunner_.add(suite);
-661   }
-662 
-663   this.currentSuite = suite;
-664 
-665   specDefinitions.call(suite);
-666 
-667   this.currentSuite = parentSuite;
-668 
-669   return suite;
-670 };
-671 
-672 jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
-673   if (this.currentSuite) {
-674     this.currentSuite.beforeEach(beforeEachFunction);
-675   } else {
-676     this.currentRunner_.beforeEach(beforeEachFunction);
-677   }
+649 /**
+650  * Register a reporter to receive status updates from Jasmine.
+651  * @param {jasmine.Reporter} reporter An object which will receive status updates.
+652  */
+653 jasmine.Env.prototype.addReporter = function(reporter) {
+654   this.reporter.addReporter(reporter);
+655 };
+656 
+657 jasmine.Env.prototype.execute = function() {
+658   this.currentRunner_.execute();
+659 };
+660 
+661 jasmine.Env.prototype.describe = function(description, specDefinitions) {
+662   var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
+663 
+664   var parentSuite = this.currentSuite;
+665   if (parentSuite) {
+666     parentSuite.add(suite);
+667   } else {
+668     this.currentRunner_.add(suite);
+669   }
+670 
+671   this.currentSuite = suite;
+672 
+673   specDefinitions.call(suite);
+674 
+675   this.currentSuite = parentSuite;
+676 
+677   return suite;
 678 };
 679 
-680 jasmine.Env.prototype.currentRunner = function () {
-681   return this.currentRunner_;
-682 };
-683 
-684 jasmine.Env.prototype.afterEach = function(afterEachFunction) {
-685   if (this.currentSuite) {
-686     this.currentSuite.afterEach(afterEachFunction);
-687   } else {
-688     this.currentRunner_.afterEach(afterEachFunction);
-689   }
-690 
-691 };
-692 
-693 jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
-694   return {
-695     execute: function() {
-696     }
-697   };
-698 };
-699 
-700 jasmine.Env.prototype.it = function(description, func) {
-701   var spec = new jasmine.Spec(this, this.currentSuite, description);
-702   this.currentSuite.add(spec);
-703   this.currentSpec = spec;
-704 
-705   if (func) {
-706     spec.runs(func);
-707   }
-708 
-709   return spec;
-710 };
-711 
-712 jasmine.Env.prototype.xit = function(desc, func) {
-713   return {
-714     id: this.nextSpecId(),
-715     runs: function() {
-716     }
-717   };
+680 jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
+681   if (this.currentSuite) {
+682     this.currentSuite.beforeEach(beforeEachFunction);
+683   } else {
+684     this.currentRunner_.beforeEach(beforeEachFunction);
+685   }
+686 };
+687 
+688 jasmine.Env.prototype.currentRunner = function () {
+689   return this.currentRunner_;
+690 };
+691 
+692 jasmine.Env.prototype.afterEach = function(afterEachFunction) {
+693   if (this.currentSuite) {
+694     this.currentSuite.afterEach(afterEachFunction);
+695   } else {
+696     this.currentRunner_.afterEach(afterEachFunction);
+697   }
+698 
+699 };
+700 
+701 jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
+702   return {
+703     execute: function() {
+704     }
+705   };
+706 };
+707 
+708 jasmine.Env.prototype.it = function(description, func) {
+709   var spec = new jasmine.Spec(this, this.currentSuite, description);
+710   this.currentSuite.add(spec);
+711   this.currentSpec = spec;
+712 
+713   if (func) {
+714     spec.runs(func);
+715   }
+716 
+717   return spec;
 718 };
 719 
-720 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
-721   if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
-722     return true;
-723   }
-724 
-725   a.__Jasmine_been_here_before__ = b;
-726   b.__Jasmine_been_here_before__ = a;
+720 jasmine.Env.prototype.xit = function(desc, func) {
+721   return {
+722     id: this.nextSpecId(),
+723     runs: function() {
+724     }
+725   };
+726 };
 727 
-728   var hasKey = function(obj, keyName) {
-729     return obj != null && obj[keyName] !== undefined;
-730   };
-731 
-732   for (var property in b) {
-733     if (!hasKey(a, property) && hasKey(b, property)) {
-734       mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>.");
-735     }
-736   }
-737   for (property in a) {
-738     if (!hasKey(b, property) && hasKey(a, property)) {
-739       mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual.");
-740     }
-741   }
-742   for (property in b) {
-743     if (property == '__Jasmine_been_here_before__') continue;
-744     if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
-745       mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />");
-746     }
-747   }
-748 
-749   if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
-750     mismatchValues.push("arrays were not the same length");
-751   }
-752 
-753   delete a.__Jasmine_been_here_before__;
-754   delete b.__Jasmine_been_here_before__;
-755   return (mismatchKeys.length == 0 && mismatchValues.length == 0);
-756 };
-757 
-758 jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
-759   mismatchKeys = mismatchKeys || [];
-760   mismatchValues = mismatchValues || [];
-761 
-762   if (a === b) return true;
-763 
-764   if (a === undefined || a === null || b === undefined || b === null) {
-765     return (a == undefined && b == undefined);
-766   }
-767 
-768   if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
-769     return a === b;
-770   }
+728 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
+729   if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
+730     return true;
+731   }
+732 
+733   a.__Jasmine_been_here_before__ = b;
+734   b.__Jasmine_been_here_before__ = a;
+735 
+736   var hasKey = function(obj, keyName) {
+737     return obj != null && obj[keyName] !== undefined;
+738   };
+739 
+740   for (var property in b) {
+741     if (!hasKey(a, property) && hasKey(b, property)) {
+742       mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>.");
+743     }
+744   }
+745   for (property in a) {
+746     if (!hasKey(b, property) && hasKey(a, property)) {
+747       mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual.");
+748     }
+749   }
+750   for (property in b) {
+751     if (property == '__Jasmine_been_here_before__') continue;
+752     if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
+753       mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />");
+754     }
+755   }
+756 
+757   if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
+758     mismatchValues.push("arrays were not the same length");
+759   }
+760 
+761   delete a.__Jasmine_been_here_before__;
+762   delete b.__Jasmine_been_here_before__;
+763   return (mismatchKeys.length == 0 && mismatchValues.length == 0);
+764 };
+765 
+766 jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
+767   mismatchKeys = mismatchKeys || [];
+768   mismatchValues = mismatchValues || [];
+769 
+770   if (a === b) return true;
 771 
-772   if (a instanceof Date && b instanceof Date) {
-773     return a.getTime() == b.getTime();
+772   if (a === undefined || a === null || b === undefined || b === null) {
+773     return (a == undefined && b == undefined);
 774   }
 775 
-776   if (a instanceof jasmine.Matchers.Any) {
-777     return a.matches(b);
+776   if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
+777     return a === b;
 778   }
 779 
-780   if (b instanceof jasmine.Matchers.Any) {
-781     return b.matches(a);
+780   if (a instanceof Date && b instanceof Date) {
+781     return a.getTime() == b.getTime();
 782   }
 783 
-784   if (typeof a === "object" && typeof b === "object") {
-785     return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
+784   if (a instanceof jasmine.Matchers.Any) {
+785     return a.matches(b);
 786   }
 787 
-788   for (var i = 0; i < this.equalityTesters_.length; i++) {
-789     var equalityTester = this.equalityTesters_[i];
-790     var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
-791     if (result !== undefined) return result;
-792   }
-793 
-794   //Straight check
-795   return (a === b);
-796 };
-797 
-798 jasmine.Env.prototype.contains_ = function(haystack, needle) {
-799   if (jasmine.isArray_(haystack)) {
-800     for (var i = 0; i < haystack.length; i++) {
-801       if (this.equals_(haystack[i], needle)) return true;
-802     }
-803     return false;
-804   }
-805   return haystack.indexOf(needle) >= 0;
-806 };
-807 
-808 jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
-809   this.equalityTesters_.push(equalityTester);
-810 };
-811 /** No-op base class for Jasmine reporters.
-812  *
-813  * @constructor
-814  */
-815 jasmine.Reporter = function() {
-816 };
-817 
-818 //noinspection JSUnusedLocalSymbols
-819 jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
-820 };
-821 
-822 //noinspection JSUnusedLocalSymbols
-823 jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
+788   if (b instanceof jasmine.Matchers.Any) {
+789     return b.matches(a);
+790   }
+791 
+792   if (typeof a === "object" && typeof b === "object") {
+793     return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
+794   }
+795 
+796   for (var i = 0; i < this.equalityTesters_.length; i++) {
+797     var equalityTester = this.equalityTesters_[i];
+798     var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
+799     if (result !== undefined) return result;
+800   }
+801 
+802   //Straight check
+803   return (a === b);
+804 };
+805 
+806 jasmine.Env.prototype.contains_ = function(haystack, needle) {
+807   if (jasmine.isArray_(haystack)) {
+808     for (var i = 0; i < haystack.length; i++) {
+809       if (this.equals_(haystack[i], needle)) return true;
+810     }
+811     return false;
+812   }
+813   return haystack.indexOf(needle) >= 0;
+814 };
+815 
+816 jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
+817   this.equalityTesters_.push(equalityTester);
+818 };
+819 /** No-op base class for Jasmine reporters.
+820  *
+821  * @constructor
+822  */
+823 jasmine.Reporter = function() {
 824 };
 825 
 826 //noinspection JSUnusedLocalSymbols
-827 jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
+827 jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
 828 };
 829 
 830 //noinspection JSUnusedLocalSymbols
-831 jasmine.Reporter.prototype.reportSpecResults = function(spec) {
+831 jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
 832 };
 833 
 834 //noinspection JSUnusedLocalSymbols
-835 jasmine.Reporter.prototype.log = function(str) {
+835 jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
 836 };
 837 
-838 /**
-839  * Blocks are functions with executable code that make up a spec.
-840  *
-841  * @constructor
-842  * @param {jasmine.Env} env
-843  * @param {Function} func
-844  * @param {jasmine.Spec} spec
-845  */
-846 jasmine.Block = function(env, func, spec) {
-847   this.env = env;
-848   this.func = func;
-849   this.spec = spec;
-850 };
-851 
-852 jasmine.Block.prototype.execute = function(onComplete) {  
-853   try {
-854     this.func.apply(this.spec);
-855   } catch (e) {
-856     this.spec.fail(e);
-857   }
-858   onComplete();
-859 };
-860 /** JavaScript API reporter.
-861  *
-862  * @constructor
-863  */
-864 jasmine.JsApiReporter = function() {
-865   this.started = false;
-866   this.finished = false;
-867   this.suites_ = [];
-868   this.results_ = {};
-869 };
-870 
-871 jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
-872   this.started = true;
-873   var suites = runner.suites();
-874   for (var i = 0; i < suites.length; i++) {
-875     var suite = suites[i];
-876     this.suites_.push(this.summarize_(suite));
-877   }
-878 };
-879 
-880 jasmine.JsApiReporter.prototype.suites = function() {
-881   return this.suites_;
-882 };
-883 
-884 jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
-885   var isSuite = suiteOrSpec instanceof jasmine.Suite
-886   var summary = {
-887     id: suiteOrSpec.id,
-888     name: suiteOrSpec.description,
-889     type: isSuite ? 'suite' : 'spec',
-890     children: []
-891   };
-892   if (isSuite) {
-893     var specs = suiteOrSpec.specs();
-894     for (var i = 0; i < specs.length; i++) {
-895       summary.children.push(this.summarize_(specs[i]));
-896     }
-897   }
-898   return summary;
-899 };
-900 
-901 jasmine.JsApiReporter.prototype.results = function() {
-902   return this.results_;
-903 };
-904 
-905 jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
-906   return this.results_[specId];
+838 //noinspection JSUnusedLocalSymbols
+839 jasmine.Reporter.prototype.reportSpecResults = function(spec) {
+840 };
+841 
+842 //noinspection JSUnusedLocalSymbols
+843 jasmine.Reporter.prototype.log = function(str) {
+844 };
+845 
+846 /**
+847  * Blocks are functions with executable code that make up a spec.
+848  *
+849  * @constructor
+850  * @param {jasmine.Env} env
+851  * @param {Function} func
+852  * @param {jasmine.Spec} spec
+853  */
+854 jasmine.Block = function(env, func, spec) {
+855   this.env = env;
+856   this.func = func;
+857   this.spec = spec;
+858 };
+859 
+860 jasmine.Block.prototype.execute = function(onComplete) {  
+861   try {
+862     this.func.apply(this.spec);
+863   } catch (e) {
+864     this.spec.fail(e);
+865   }
+866   onComplete();
+867 };
+868 /** JavaScript API reporter.
+869  *
+870  * @constructor
+871  */
+872 jasmine.JsApiReporter = function() {
+873   this.started = false;
+874   this.finished = false;
+875   this.suites_ = [];
+876   this.results_ = {};
+877 };
+878 
+879 jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
+880   this.started = true;
+881   var suites = runner.suites();
+882   for (var i = 0; i < suites.length; i++) {
+883     var suite = suites[i];
+884     this.suites_.push(this.summarize_(suite));
+885   }
+886 };
+887 
+888 jasmine.JsApiReporter.prototype.suites = function() {
+889   return this.suites_;
+890 };
+891 
+892 jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
+893   var isSuite = suiteOrSpec instanceof jasmine.Suite
+894   var summary = {
+895     id: suiteOrSpec.id,
+896     name: suiteOrSpec.description,
+897     type: isSuite ? 'suite' : 'spec',
+898     children: []
+899   };
+900   if (isSuite) {
+901     var specs = suiteOrSpec.specs();
+902     for (var i = 0; i < specs.length; i++) {
+903       summary.children.push(this.summarize_(specs[i]));
+904     }
+905   }
+906   return summary;
 907 };
 908 
-909 //noinspection JSUnusedLocalSymbols
-910 jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
-911   this.finished = true;
-912 };
-913 
-914 //noinspection JSUnusedLocalSymbols
-915 jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
-916 };
-917 
-918 //noinspection JSUnusedLocalSymbols
-919 jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
-920   this.results_[spec.id] = {
-921     messages: spec.results().getItems(),
-922     result: spec.results().failedCount > 0 ? "failed" : "passed"
-923   };
+909 jasmine.JsApiReporter.prototype.results = function() {
+910   return this.results_;
+911 };
+912 
+913 jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
+914   return this.results_[specId];
+915 };
+916 
+917 //noinspection JSUnusedLocalSymbols
+918 jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
+919   this.finished = true;
+920 };
+921 
+922 //noinspection JSUnusedLocalSymbols
+923 jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
 924 };
 925 
 926 //noinspection JSUnusedLocalSymbols
-927 jasmine.JsApiReporter.prototype.log = function(str) {
-928 };
-929 
-930 jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
-931   var results = {};
-932   for (var i = 0; i < specIds.length; i++) {
-933     var specId = specIds[i];
-934     results[specId] = this.summarizeResult_(this.results_[specId]);
-935   }
-936   return results;
-937 };
-938 
-939 jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
-940   var summaryMessages = [];
-941   for (var messageIndex in result.messages) {
-942     var resultMessage = result.messages[messageIndex];
-943     summaryMessages.push({
-944       text: resultMessage.text,
-945       passed: resultMessage.passed ? resultMessage.passed() : true,
-946       type: resultMessage.type,
-947       message: resultMessage.message,
-948       trace: {
-949         stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined
-950       }
-951     });
-952   };
-953 
-954   var summaryResult = {
-955     result : result.result,
-956     messages : summaryMessages
-957   };
-958 
-959   return summaryResult;
-960 };
+927 jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
+928   this.results_[spec.id] = {
+929     messages: spec.results().getItems(),
+930     result: spec.results().failedCount > 0 ? "failed" : "passed"
+931   };
+932 };
+933 
+934 //noinspection JSUnusedLocalSymbols
+935 jasmine.JsApiReporter.prototype.log = function(str) {
+936 };
+937 
+938 jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
+939   var results = {};
+940   for (var i = 0; i < specIds.length; i++) {
+941     var specId = specIds[i];
+942     results[specId] = this.summarizeResult_(this.results_[specId]);
+943   }
+944   return results;
+945 };
+946 
+947 jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
+948   var summaryMessages = [];
+949   for (var messageIndex in result.messages) {
+950     var resultMessage = result.messages[messageIndex];
+951     summaryMessages.push({
+952       text: resultMessage.text,
+953       passed: resultMessage.passed ? resultMessage.passed() : true,
+954       type: resultMessage.type,
+955       message: resultMessage.message,
+956       trace: {
+957         stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : undefined
+958       }
+959     });
+960   };
 961 
-962 jasmine.Matchers = function(env, actual, results) {
-963   this.env = env;
-964   this.actual = actual;
-965   this.passing_message = 'Passed.';
-966   this.results_ = results || new jasmine.NestedResults();
-967 };
-968 
-969 jasmine.Matchers.pp = function(str) {
-970   return jasmine.util.htmlEscape(jasmine.pp(str));
-971 };
-972 
-973 /** @deprecated */
-974 jasmine.Matchers.prototype.getResults = function() {
-975   return this.results_;
-976 };
-977 
-978 jasmine.Matchers.prototype.results = function() {
-979   return this.results_;
-980 };
-981 
-982 jasmine.Matchers.prototype.report = function(result, failing_message, details) {
-983   this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
-984   return result;
-985 };
-986 
-987 /**
-988  * Matcher that compares the actual to the expected using ===.
-989  *
-990  * @param expected
-991  */
-992 jasmine.Matchers.prototype.toBe = function(expected) {
-993   return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
-994     + '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual)
-995     + '<br />');
-996 };
-997 
-998 /**
-999  * Matcher that compares the actual to the expected using !==
-1000  * @param expected
-1001  */
-1002 jasmine.Matchers.prototype.toNotBe = function(expected) {
-1003   return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
-1004     + '<br /><br />to be a different object from actual, but they were the same.');
-1005 };
-1006 
-1007 /**
-1008  * Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
-1009  *
-1010  * @param expected
-1011  */
-1012 jasmine.Matchers.prototype.toEqual = function(expected) {
-1013   var mismatchKeys = [];
-1014   var mismatchValues = [];
-1015 
-1016   var formatMismatches = function(name, array) {
-1017     if (array.length == 0) return '';
-1018     var errorOutput = '<br /><br />Different ' + name + ':<br />';
-1019     for (var i = 0; i < array.length; i++) {
-1020       errorOutput += array[i] + '<br />';
-1021     }
-1022     return errorOutput;
-1023   };
-1024 
-1025   return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues),
-1026     'Expected<br /><br />' + jasmine.Matchers.pp(expected)
-1027       + '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual)
-1028       + '<br />'
-1029       + formatMismatches('Keys', mismatchKeys)
-1030       + formatMismatches('Values', mismatchValues), {
-1031     matcherName: 'toEqual', expected: expected, actual: this.actual
-1032   });
-1033 };
-1034 /** @deprecated */
-1035 jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual;
-1036 
-1037 /**
-1038  * Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual
-1039  * @param expected
-1040  */
-1041 jasmine.Matchers.prototype.toNotEqual = function(expected) {
-1042   return this.report(!this.env.equals_(this.actual, expected),
-1043     'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.');
-1044 };
-1045 /** @deprecated */
-1046 jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual;
-1047 
-1048 /**
-1049  * Matcher that compares the actual to the expected using a regular expression.  Constructs a RegExp, so takes
-1050  * a pattern or a String.
-1051  *
-1052  * @param reg_exp
-1053  */
-1054 jasmine.Matchers.prototype.toMatch = function(reg_exp) {
-1055   return this.report((new RegExp(reg_exp).test(this.actual)),
-1056     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.');
-1057 };
-1058 /** @deprecated */
-1059 jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch;
-1060 
-1061 /**
-1062  * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
-1063  * @param reg_exp
-1064  */
-1065 jasmine.Matchers.prototype.toNotMatch = function(reg_exp) {
-1066   return this.report((!new RegExp(reg_exp).test(this.actual)),
-1067     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.');
-1068 };
-1069 /** @deprecated */
-1070 jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch;
-1071 
-1072 /**
-1073  * Matcher that compares the acutal to undefined.
-1074  */
-1075 jasmine.Matchers.prototype.toBeDefined = function() {
-1076   return this.report((this.actual !== undefined),
-1077     'Expected a value to be defined but it was undefined.');
-1078 };
-1079 /** @deprecated */
-1080 jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined;
-1081 
-1082 /**
-1083  * Matcher that compares the actual to null.
-1084  *
-1085  */
-1086 jasmine.Matchers.prototype.toBeNull = function() {
-1087   return this.report((this.actual === null),
-1088     'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.');
-1089 };
-1090 /** @deprecated */
-1091 jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull;
-1092 
-1093 /**
-1094  * Matcher that boolean not-nots the actual.
-1095  */
-1096 jasmine.Matchers.prototype.toBeTruthy = function() {
-1097   return this.report(!!this.actual,
-1098     'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
-1099 };
-1100 /** @deprecated */
-1101 jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy;
-1102 
-1103 /**
-1104  * Matcher that boolean nots the actual.
-1105  */
-1106 jasmine.Matchers.prototype.toBeFalsy = function() {
-1107   return this.report(!this.actual,
-1108     'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
-1109 };
-1110 /** @deprecated */
-1111 jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy;
-1112 
-1113 /**
-1114  * Matcher that checks to see if the acutal, a Jasmine spy, was called.
-1115  */
-1116 jasmine.Matchers.prototype.wasCalled = function() {
-1117   if (!this.actual || !this.actual.isSpy) {
-1118     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
-1119   }
-1120   if (arguments.length > 0) {
-1121     return this.report(false, 'wasCalled matcher does not take arguments');
-1122   }
-1123   return this.report((this.actual.wasCalled),
-1124     'Expected spy "' + this.actual.identity + '" to have been called, but it was not.');
-1125 };
-1126 /** @deprecated */
-1127 jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled;
-1128 
-1129 /**
-1130  * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
-1131  */
-1132 jasmine.Matchers.prototype.wasNotCalled = function() {
-1133   if (!this.actual || !this.actual.isSpy) {
-1134     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
-1135   }
-1136   return this.report((!this.actual.wasCalled),
-1137     'Expected spy "' + this.actual.identity + '" to not have been called, but it was.');
-1138 };
-1139 /** @deprecated */
-1140 jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled;
-1141 
-1142 /**
-1143  * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
-1144  *
-1145  * @example
-1146  *
-1147  */
-1148 jasmine.Matchers.prototype.wasCalledWith = function() {
-1149   if (!this.actual || !this.actual.isSpy) {
-1150     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', {
-1151       matcherName: 'wasCalledWith'
-1152     });
-1153   }
-1154 
-1155   var args = jasmine.util.argsToArray(arguments);
-1156 
-1157   return this.report(this.env.contains_(this.actual.argsForCall, args),
-1158     'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', {
-1159     matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall
-1160   });
-1161 };
+962   var summaryResult = {
+963     result : result.result,
+964     messages : summaryMessages
+965   };
+966 
+967   return summaryResult;
+968 };
+969 
+970 jasmine.Matchers = function(env, actual, results) {
+971   this.env = env;
+972   this.actual = actual;
+973   this.passing_message = 'Passed.';
+974   this.results_ = results || new jasmine.NestedResults();
+975 };
+976 
+977 jasmine.Matchers.pp = function(str) {
+978   return jasmine.util.htmlEscape(jasmine.pp(str));
+979 };
+980 
+981 /** @deprecated */
+982 jasmine.Matchers.prototype.getResults = function() {
+983   return this.results_;
+984 };
+985 
+986 jasmine.Matchers.prototype.results = function() {
+987   return this.results_;
+988 };
+989 
+990 jasmine.Matchers.prototype.report = function(result, failing_message, details) {
+991   this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
+992   return result;
+993 };
+994 
+995 /**
+996  * Matcher that compares the actual to the expected using ===.
+997  *
+998  * @param expected
+999  */
+1000 jasmine.Matchers.prototype.toBe = function(expected) {
+1001   return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
+1002     + '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual)
+1003     + '<br />');
+1004 };
+1005 
+1006 /**
+1007  * Matcher that compares the actual to the expected using !==
+1008  * @param expected
+1009  */
+1010 jasmine.Matchers.prototype.toNotBe = function(expected) {
+1011   return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
+1012     + '<br /><br />to be a different object from actual, but they were the same.');
+1013 };
+1014 
+1015 /**
+1016  * Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
+1017  *
+1018  * @param expected
+1019  */
+1020 jasmine.Matchers.prototype.toEqual = function(expected) {
+1021   var mismatchKeys = [];
+1022   var mismatchValues = [];
+1023 
+1024   var formatMismatches = function(name, array) {
+1025     if (array.length == 0) return '';
+1026     var errorOutput = '<br /><br />Different ' + name + ':<br />';
+1027     for (var i = 0; i < array.length; i++) {
+1028       errorOutput += array[i] + '<br />';
+1029     }
+1030     return errorOutput;
+1031   };
+1032 
+1033   return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues),
+1034     'Expected<br /><br />' + jasmine.Matchers.pp(expected)
+1035       + '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual)
+1036       + '<br />'
+1037       + formatMismatches('Keys', mismatchKeys)
+1038       + formatMismatches('Values', mismatchValues), {
+1039     matcherName: 'toEqual', expected: expected, actual: this.actual
+1040   });
+1041 };
+1042 /** @deprecated */
+1043 jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual;
+1044 
+1045 /**
+1046  * Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual
+1047  * @param expected
+1048  */
+1049 jasmine.Matchers.prototype.toNotEqual = function(expected) {
+1050   return this.report(!this.env.equals_(this.actual, expected),
+1051     'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.');
+1052 };
+1053 /** @deprecated */
+1054 jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual;
+1055 
+1056 /**
+1057  * Matcher that compares the actual to the expected using a regular expression.  Constructs a RegExp, so takes
+1058  * a pattern or a String.
+1059  *
+1060  * @param reg_exp
+1061  */
+1062 jasmine.Matchers.prototype.toMatch = function(reg_exp) {
+1063   return this.report((new RegExp(reg_exp).test(this.actual)),
+1064     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.');
+1065 };
+1066 /** @deprecated */
+1067 jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch;
+1068 
+1069 /**
+1070  * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
+1071  * @param reg_exp
+1072  */
+1073 jasmine.Matchers.prototype.toNotMatch = function(reg_exp) {
+1074   return this.report((!new RegExp(reg_exp).test(this.actual)),
+1075     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.');
+1076 };
+1077 /** @deprecated */
+1078 jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch;
+1079 
+1080 /**
+1081  * Matcher that compares the acutal to undefined.
+1082  */
+1083 jasmine.Matchers.prototype.toBeDefined = function() {
+1084   return this.report((this.actual !== undefined),
+1085     'Expected a value to be defined but it was undefined.');
+1086 };
+1087 /** @deprecated */
+1088 jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined;
+1089 
+1090 /**
+1091  * Matcher that compares the actual to null.
+1092  *
+1093  */
+1094 jasmine.Matchers.prototype.toBeNull = function() {
+1095   return this.report((this.actual === null),
+1096     'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.');
+1097 };
+1098 /** @deprecated */
+1099 jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull;
+1100 
+1101 /**
+1102  * Matcher that boolean not-nots the actual.
+1103  */
+1104 jasmine.Matchers.prototype.toBeTruthy = function() {
+1105   return this.report(!!this.actual,
+1106     'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
+1107 };
+1108 /** @deprecated */
+1109 jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy;
+1110 
+1111 /**
+1112  * Matcher that boolean nots the actual.
+1113  */
+1114 jasmine.Matchers.prototype.toBeFalsy = function() {
+1115   return this.report(!this.actual,
+1116     'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
+1117 };
+1118 /** @deprecated */
+1119 jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy;
+1120 
+1121 /**
+1122  * Matcher that checks to see if the acutal, a Jasmine spy, was called.
+1123  */
+1124 jasmine.Matchers.prototype.wasCalled = function() {
+1125   if (!this.actual || !this.actual.isSpy) {
+1126     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
+1127   }
+1128   if (arguments.length > 0) {
+1129     return this.report(false, 'wasCalled matcher does not take arguments');
+1130   }
+1131   return this.report((this.actual.wasCalled),
+1132     'Expected spy "' + this.actual.identity + '" to have been called, but it was not.');
+1133 };
+1134 /** @deprecated */
+1135 jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled;
+1136 
+1137 /**
+1138  * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
+1139  */
+1140 jasmine.Matchers.prototype.wasNotCalled = function() {
+1141   if (!this.actual || !this.actual.isSpy) {
+1142     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
+1143   }
+1144   return this.report((!this.actual.wasCalled),
+1145     'Expected spy "' + this.actual.identity + '" to not have been called, but it was.');
+1146 };
+1147 /** @deprecated */
+1148 jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled;
+1149 
+1150 /**
+1151  * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
+1152  *
+1153  * @example
+1154  *
+1155  */
+1156 jasmine.Matchers.prototype.wasCalledWith = function() {
+1157   if (!this.actual || !this.actual.isSpy) {
+1158     return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', {
+1159       matcherName: 'wasCalledWith'
+1160     });
+1161   }
 1162 
-1163 /**
-1164  * Matcher that checks that the expected item is an element in the actual Array.
-1165  *
-1166  * @param {Object} item
-1167  */
-1168 jasmine.Matchers.prototype.toContain = function(item) {
-1169   return this.report(this.env.contains_(this.actual, item),
-1170     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', {
-1171     matcherName: 'toContain', expected: item, actual: this.actual
-1172   });
-1173 };
-1174 
-1175 /**
-1176  * Matcher that checks that the expected item is NOT an element in the actual Array.
-1177  *
-1178  * @param {Object} item
-1179  */
-1180 jasmine.Matchers.prototype.toNotContain = function(item) {
-1181   return this.report(!this.env.contains_(this.actual, item),
-1182     'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
-1183 };
-1184 
-1185 jasmine.Matchers.prototype.toBeLessThan = function(expected) {
-1186   return this.report(this.actual < expected,
-1187     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
-1188 };
-1189 
-1190 jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
-1191   return this.report(this.actual > expected,
-1192     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
-1193 };
-1194 
-1195 /**
-1196  * Matcher that checks that the expected exception was thrown by the actual.
-1197  *
-1198  * @param {String} expectedException
-1199  */
-1200 jasmine.Matchers.prototype.toThrow = function(expectedException) {
-1201   var exception = null;
-1202   try {
-1203     this.actual();
-1204   } catch (e) {
-1205     exception = e;
-1206   }
-1207   if (expectedException !== undefined) {
-1208     if (exception == null) {
-1209       return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not.");
-1210     }
-1211     return this.report(
-1212       this.env.equals_(
-1213         exception.message || exception,
-1214         expectedException.message || expectedException),
-1215       "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + ".");
-1216   } else {
-1217     return this.report(exception != null, "Expected function to throw an exception, but it did not.");
-1218   }
-1219 };
-1220 
-1221 jasmine.Matchers.Any = function(expectedClass) {
-1222   this.expectedClass = expectedClass;
-1223 };
-1224 
-1225 jasmine.Matchers.Any.prototype.matches = function(other) {
-1226   if (this.expectedClass == String) {
-1227     return typeof other == 'string' || other instanceof String;
-1228   }
-1229 
-1230   if (this.expectedClass == Number) {
-1231     return typeof other == 'number' || other instanceof Number;
-1232   }
-1233 
-1234   if (this.expectedClass == Function) {
-1235     return typeof other == 'function' || other instanceof Function;
+1163   var args = jasmine.util.argsToArray(arguments);
+1164 
+1165   return this.report(this.env.contains_(this.actual.argsForCall, args),
+1166     'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', {
+1167     matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall
+1168   });
+1169 };
+1170 
+1171 /**
+1172  * Matcher that checks that the expected item is an element in the actual Array.
+1173  *
+1174  * @param {Object} item
+1175  */
+1176 jasmine.Matchers.prototype.toContain = function(item) {
+1177   return this.report(this.env.contains_(this.actual, item),
+1178     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', {
+1179     matcherName: 'toContain', expected: item, actual: this.actual
+1180   });
+1181 };
+1182 
+1183 /**
+1184  * Matcher that checks that the expected item is NOT an element in the actual Array.
+1185  *
+1186  * @param {Object} item
+1187  */
+1188 jasmine.Matchers.prototype.toNotContain = function(item) {
+1189   return this.report(!this.env.contains_(this.actual, item),
+1190     'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
+1191 };
+1192 
+1193 jasmine.Matchers.prototype.toBeLessThan = function(expected) {
+1194   return this.report(this.actual < expected,
+1195     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
+1196 };
+1197 
+1198 jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
+1199   return this.report(this.actual > expected,
+1200     'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
+1201 };
+1202 
+1203 /**
+1204  * Matcher that checks that the expected exception was thrown by the actual.
+1205  *
+1206  * @param {String} expectedException
+1207  */
+1208 jasmine.Matchers.prototype.toThrow = function(expectedException) {
+1209   var exception = null;
+1210   try {
+1211     this.actual();
+1212   } catch (e) {
+1213     exception = e;
+1214   }
+1215   if (expectedException !== undefined) {
+1216     if (exception == null) {
+1217       return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not.");
+1218     }
+1219     return this.report(
+1220       this.env.equals_(
+1221         exception.message || exception,
+1222         expectedException.message || expectedException),
+1223       "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + ".");
+1224   } else {
+1225     return this.report(exception != null, "Expected function to throw an exception, but it did not.");
+1226   }
+1227 };
+1228 
+1229 jasmine.Matchers.Any = function(expectedClass) {
+1230   this.expectedClass = expectedClass;
+1231 };
+1232 
+1233 jasmine.Matchers.Any.prototype.matches = function(other) {
+1234   if (this.expectedClass == String) {
+1235     return typeof other == 'string' || other instanceof String;
 1236   }
 1237 
-1238   if (this.expectedClass == Object) {
-1239     return typeof other == 'object';
+1238   if (this.expectedClass == Number) {
+1239     return typeof other == 'number' || other instanceof Number;
 1240   }
 1241 
-1242   return other instanceof this.expectedClass;
-1243 };
-1244 
-1245 jasmine.Matchers.Any.prototype.toString = function() {
-1246   return '<jasmine.any(' + this.expectedClass + ')>';
-1247 };
-1248 
-1249 /**
-1250  * @constructor
-1251  */
-1252 jasmine.MultiReporter = function() {
-1253   this.subReporters_ = [];
-1254 };
-1255 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
+1242   if (this.expectedClass == Function) {
+1243     return typeof other == 'function' || other instanceof Function;
+1244   }
+1245 
+1246   if (this.expectedClass == Object) {
+1247     return typeof other == 'object';
+1248   }
+1249 
+1250   return other instanceof this.expectedClass;
+1251 };
+1252 
+1253 jasmine.Matchers.Any.prototype.toString = function() {
+1254   return '<jasmine.any(' + this.expectedClass + ')>';
+1255 };
 1256 
-1257 jasmine.MultiReporter.prototype.addReporter = function(reporter) {
-1258   this.subReporters_.push(reporter);
-1259 };
-1260 
-1261 (function() {
-1262   var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
-1263   for (var i = 0; i < functionNames.length; i++) {
-1264     var functionName = functionNames[i];
-1265     jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
-1266       return function() {
-1267         for (var j = 0; j < this.subReporters_.length; j++) {
-1268           var subReporter = this.subReporters_[j];
-1269           if (subReporter[functionName]) {
-1270             subReporter[functionName].apply(subReporter, arguments);
-1271           }
-1272         }
-1273       };
-1274     })(functionName);
-1275   }
-1276 })();
-1277 /**
-1278  * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
-1279  *
-1280  * @constructor
-1281  */
-1282 jasmine.NestedResults = function() {
-1283   /**
-1284    * The total count of results
-1285    */
-1286   this.totalCount = 0;
-1287   /**
-1288    * Number of passed results
-1289    */
-1290   this.passedCount = 0;
+1257 /**
+1258  * @constructor
+1259  */
+1260 jasmine.MultiReporter = function() {
+1261   this.subReporters_ = [];
+1262 };
+1263 jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
+1264 
+1265 jasmine.MultiReporter.prototype.addReporter = function(reporter) {
+1266   this.subReporters_.push(reporter);
+1267 };
+1268 
+1269 (function() {
+1270   var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
+1271   for (var i = 0; i < functionNames.length; i++) {
+1272     var functionName = functionNames[i];
+1273     jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
+1274       return function() {
+1275         for (var j = 0; j < this.subReporters_.length; j++) {
+1276           var subReporter = this.subReporters_[j];
+1277           if (subReporter[functionName]) {
+1278             subReporter[functionName].apply(subReporter, arguments);
+1279           }
+1280         }
+1281       };
+1282     })(functionName);
+1283   }
+1284 })();
+1285 /**
+1286  * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
+1287  *
+1288  * @constructor
+1289  */
+1290 jasmine.NestedResults = function() {
 1291   /**
-1292    * Number of failed results
+1292    * The total count of results
 1293    */
-1294   this.failedCount = 0;
+1294   this.totalCount = 0;
 1295   /**
-1296    * Was this suite/spec skipped?
+1296    * Number of passed results
 1297    */
-1298   this.skipped = false;
+1298   this.passedCount = 0;
 1299   /**
-1300    * @ignore
+1300    * Number of failed results
 1301    */
-1302   this.items_ = [];
-1303 };
-1304 
-1305 /**
-1306  * Roll up the result counts.
-1307  *
-1308  * @param result
-1309  */
-1310 jasmine.NestedResults.prototype.rollupCounts = function(result) {
-1311   this.totalCount += result.totalCount;
-1312   this.passedCount += result.passedCount;
-1313   this.failedCount += result.failedCount;
-1314 };
-1315 
-1316 /**
-1317  * Tracks a result's message.
-1318  * @param message
-1319  */
-1320 jasmine.NestedResults.prototype.log = function(message) {
-1321   this.items_.push(new jasmine.MessageResult(message));
+1302   this.failedCount = 0;
+1303   /**
+1304    * Was this suite/spec skipped?
+1305    */
+1306   this.skipped = false;
+1307   /**
+1308    * @ignore
+1309    */
+1310   this.items_ = [];
+1311 };
+1312 
+1313 /**
+1314  * Roll up the result counts.
+1315  *
+1316  * @param result
+1317  */
+1318 jasmine.NestedResults.prototype.rollupCounts = function(result) {
+1319   this.totalCount += result.totalCount;
+1320   this.passedCount += result.passedCount;
+1321   this.failedCount += result.failedCount;
 1322 };
 1323 
 1324 /**
-1325  * Getter for the results: message & results.
-1326  */
-1327 jasmine.NestedResults.prototype.getItems = function() {
-1328   return this.items_;
-1329 };
-1330 
-1331 /**
-1332  * Adds a result, tracking counts (total, passed, & failed)
-1333  * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
+1325  * Tracks a result's message.
+1326  * @param message
+1327  */
+1328 jasmine.NestedResults.prototype.log = function(message) {
+1329   this.items_.push(new jasmine.MessageResult(message));
+1330 };
+1331 
+1332 /**
+1333  * Getter for the results: message & results.
 1334  */
-1335 jasmine.NestedResults.prototype.addResult = function(result) {
-1336   if (result.type != 'MessageResult') {
-1337     if (result.items_) {
-1338       this.rollupCounts(result);
-1339     } else {
-1340       this.totalCount++;
-1341       if (result.passed()) {
-1342         this.passedCount++;
-1343       } else {
-1344         this.failedCount++;
-1345       }
-1346     }
-1347   }
-1348   this.items_.push(result);
-1349 };
-1350 
-1351 /**
-1352  * @returns {Boolean} True if <b>everything</b> below passed
-1353  */
-1354 jasmine.NestedResults.prototype.passed = function() {
-1355   return this.passedCount === this.totalCount;
-1356 };
-1357 /**
-1358  * Base class for pretty printing for expectation results.
-1359  */
-1360 jasmine.PrettyPrinter = function() {
-1361   this.ppNestLevel_ = 0;
-1362 };
-1363 
-1364 /**
-1365  * Formats a value in a nice, human-readable string.
-1366  *
-1367  * @param value
-1368  * @returns {String}
-1369  */
-1370 jasmine.PrettyPrinter.prototype.format = function(value) {
-1371   if (this.ppNestLevel_ > 40) {
-1372     //    return '(jasmine.pp nested too deeply!)';
-1373     throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
-1374   }
-1375 
-1376   this.ppNestLevel_++;
-1377   try {
-1378     if (value === undefined) {
-1379       this.emitScalar('undefined');
-1380     } else if (value === null) {
-1381       this.emitScalar('null');
-1382     } else if (value.navigator && value.frames && value.setTimeout) {
-1383       this.emitScalar('<window>');
-1384     } else if (value instanceof jasmine.Matchers.Any) {
-1385       this.emitScalar(value.toString());
-1386     } else if (typeof value === 'string') {
-1387       this.emitString(value);
-1388     } else if (typeof value === 'function') {
-1389       this.emitScalar('Function');
-1390     } else if (typeof value.nodeType === 'number') {
-1391       this.emitScalar('HTMLNode');
-1392     } else if (value instanceof Date) {
-1393       this.emitScalar('Date(' + value + ')');
-1394     } else if (value.__Jasmine_been_here_before__) {
-1395       this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
-1396     } else if (jasmine.isArray_(value) || typeof value == 'object') {
-1397       value.__Jasmine_been_here_before__ = true;
-1398       if (jasmine.isArray_(value)) {
-1399         this.emitArray(value);
-1400       } else {
-1401         this.emitObject(value);
-1402       }
-1403       delete value.__Jasmine_been_here_before__;
-1404     } else {
-1405       this.emitScalar(value.toString());
-1406     }
-1407   } finally {
-1408     this.ppNestLevel_--;
-1409   }
-1410 };
-1411 
-1412 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
-1413   for (var property in obj) {
-1414     if (property == '__Jasmine_been_here_before__') continue;
-1415     fn(property, obj.__lookupGetter__(property) != null);
-1416   }
-1417 };
-1418 
-1419 jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
-1420 jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
-1421 jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
-1422 jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
-1423 
-1424 jasmine.StringPrettyPrinter = function() {
-1425   jasmine.PrettyPrinter.call(this);
+1335 jasmine.NestedResults.prototype.getItems = function() {
+1336   return this.items_;
+1337 };
+1338 
+1339 /**
+1340  * Adds a result, tracking counts (total, passed, & failed)
+1341  * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
+1342  */
+1343 jasmine.NestedResults.prototype.addResult = function(result) {
+1344   if (result.type != 'MessageResult') {
+1345     if (result.items_) {
+1346       this.rollupCounts(result);
+1347     } else {
+1348       this.totalCount++;
+1349       if (result.passed()) {
+1350         this.passedCount++;
+1351       } else {
+1352         this.failedCount++;
+1353       }
+1354     }
+1355   }
+1356   this.items_.push(result);
+1357 };
+1358 
+1359 /**
+1360  * @returns {Boolean} True if <b>everything</b> below passed
+1361  */
+1362 jasmine.NestedResults.prototype.passed = function() {
+1363   return this.passedCount === this.totalCount;
+1364 };
+1365 /**
+1366  * Base class for pretty printing for expectation results.
+1367  */
+1368 jasmine.PrettyPrinter = function() {
+1369   this.ppNestLevel_ = 0;
+1370 };
+1371 
+1372 /**
+1373  * Formats a value in a nice, human-readable string.
+1374  *
+1375  * @param value
+1376  * @returns {String}
+1377  */
+1378 jasmine.PrettyPrinter.prototype.format = function(value) {
+1379   if (this.ppNestLevel_ > 40) {
+1380     //    return '(jasmine.pp nested too deeply!)';
+1381     throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
+1382   }
+1383 
+1384   this.ppNestLevel_++;
+1385   try {
+1386     if (value === undefined) {
+1387       this.emitScalar('undefined');
+1388     } else if (value === null) {
+1389       this.emitScalar('null');
+1390     } else if (value.navigator && value.frames && value.setTimeout) {
+1391       this.emitScalar('<window>');
+1392     } else if (value instanceof jasmine.Matchers.Any) {
+1393       this.emitScalar(value.toString());
+1394     } else if (typeof value === 'string') {
+1395       this.emitString(value);
+1396     } else if (typeof value === 'function') {
+1397       this.emitScalar('Function');
+1398     } else if (typeof value.nodeType === 'number') {
+1399       this.emitScalar('HTMLNode');
+1400     } else if (value instanceof Date) {
+1401       this.emitScalar('Date(' + value + ')');
+1402     } else if (value.__Jasmine_been_here_before__) {
+1403       this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
+1404     } else if (jasmine.isArray_(value) || typeof value == 'object') {
+1405       value.__Jasmine_been_here_before__ = true;
+1406       if (jasmine.isArray_(value)) {
+1407         this.emitArray(value);
+1408       } else {
+1409         this.emitObject(value);
+1410       }
+1411       delete value.__Jasmine_been_here_before__;
+1412     } else {
+1413       this.emitScalar(value.toString());
+1414     }
+1415   } finally {
+1416     this.ppNestLevel_--;
+1417   }
+1418 };
+1419 
+1420 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
+1421   for (var property in obj) {
+1422     if (property == '__Jasmine_been_here_before__') continue;
+1423     fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
+1424   }
+1425 };
 1426 
-1427   this.string = '';
-1428 };
-1429 jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
-1430 
-1431 jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
-1432   this.append(value);
-1433 };
+1427 jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
+1428 jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
+1429 jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
+1430 jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
+1431 
+1432 jasmine.StringPrettyPrinter = function() {
+1433   jasmine.PrettyPrinter.call(this);
 1434 
-1435 jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
-1436   this.append("'" + value + "'");
-1437 };
+1435   this.string = '';
+1436 };
+1437 jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
 1438 
-1439 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
-1440   this.append('[ ');
-1441   for (var i = 0; i < array.length; i++) {
-1442     if (i > 0) {
-1443       this.append(', ');
-1444     }
-1445     this.format(array[i]);
-1446   }
-1447   this.append(' ]');
-1448 };
-1449 
-1450 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
-1451   var self = this;
-1452   this.append('{ ');
-1453   var first = true;
-1454 
-1455   this.iterateObject(obj, function(property, isGetter) {
-1456     if (first) {
-1457       first = false;
-1458     } else {
-1459       self.append(', ');
-1460     }
-1461 
-1462     self.append(property);
-1463     self.append(' : ');
-1464     if (isGetter) {
-1465       self.append('<getter>');
+1439 jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
+1440   this.append(value);
+1441 };
+1442 
+1443 jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
+1444   this.append("'" + value + "'");
+1445 };
+1446 
+1447 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
+1448   this.append('[ ');
+1449   for (var i = 0; i < array.length; i++) {
+1450     if (i > 0) {
+1451       this.append(', ');
+1452     }
+1453     this.format(array[i]);
+1454   }
+1455   this.append(' ]');
+1456 };
+1457 
+1458 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
+1459   var self = this;
+1460   this.append('{ ');
+1461   var first = true;
+1462 
+1463   this.iterateObject(obj, function(property, isGetter) {
+1464     if (first) {
+1465       first = false;
 1466     } else {
-1467       self.format(obj[property]);
+1467       self.append(', ');
 1468     }
-1469   });
-1470 
-1471   this.append(' }');
-1472 };
-1473 
-1474 jasmine.StringPrettyPrinter.prototype.append = function(value) {
-1475   this.string += value;
-1476 };
-1477 jasmine.Queue = function(env) {
-1478   this.env = env;
-1479   this.blocks = [];
-1480   this.running = false;
-1481   this.index = 0;
-1482   this.offset = 0;
-1483 };
-1484 
-1485 jasmine.Queue.prototype.addBefore = function(block) {
-1486   this.blocks.unshift(block);
-1487 };
-1488 
-1489 jasmine.Queue.prototype.add = function(block) {
-1490   this.blocks.push(block);
+1469 
+1470     self.append(property);
+1471     self.append(' : ');
+1472     if (isGetter) {
+1473       self.append('<getter>');
+1474     } else {
+1475       self.format(obj[property]);
+1476     }
+1477   });
+1478 
+1479   this.append(' }');
+1480 };
+1481 
+1482 jasmine.StringPrettyPrinter.prototype.append = function(value) {
+1483   this.string += value;
+1484 };
+1485 jasmine.Queue = function(env) {
+1486   this.env = env;
+1487   this.blocks = [];
+1488   this.running = false;
+1489   this.index = 0;
+1490   this.offset = 0;
 1491 };
 1492 
-1493 jasmine.Queue.prototype.insertNext = function(block) {
-1494   this.blocks.splice((this.index + this.offset + 1), 0, block);
-1495   this.offset++;
-1496 };
-1497 
-1498 jasmine.Queue.prototype.start = function(onComplete) {
-1499   this.running = true;
-1500   this.onComplete = onComplete;
-1501   this.next_();
-1502 };
-1503 
-1504 jasmine.Queue.prototype.isRunning = function() {
-1505   return this.running;
-1506 };
-1507 
-1508 jasmine.Queue.LOOP_DONT_RECURSE = true;
-1509 
-1510 jasmine.Queue.prototype.next_ = function() {
-1511   var self = this;
-1512   var goAgain = true;
-1513 
-1514   while (goAgain) {
-1515     goAgain = false;
-1516     
-1517     if (self.index < self.blocks.length) {
-1518       var calledSynchronously = true;
-1519       var completedSynchronously = false;
-1520 
-1521       var onComplete = function () {
-1522         if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
-1523           completedSynchronously = true;
-1524           return;
-1525         }
-1526 
-1527         self.offset = 0;
-1528         self.index++;
-1529 
-1530         var now = new Date().getTime();
-1531         if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
-1532           self.env.lastUpdate = now;
-1533           self.env.setTimeout(function() {
-1534             self.next_();
-1535           }, 0);
-1536         } else {
-1537           if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
-1538             goAgain = true;
-1539           } else {
-1540             self.next_();
-1541           }
-1542         }
-1543       };
-1544       self.blocks[self.index].execute(onComplete);
-1545 
-1546       calledSynchronously = false;
-1547       if (completedSynchronously) {
-1548         onComplete();
-1549       }
-1550       
-1551     } else {
-1552       self.running = false;
-1553       if (self.onComplete) {
-1554         self.onComplete();
-1555       }
-1556     }
-1557   }
-1558 };
-1559 
-1560 jasmine.Queue.prototype.results = function() {
-1561   var results = new jasmine.NestedResults();
-1562   for (var i = 0; i < this.blocks.length; i++) {
-1563     if (this.blocks[i].results) {
-1564       results.addResult(this.blocks[i].results());
-1565     }
-1566   }
-1567   return results;
-1568 };
-1569 
-1570 
-1571 /* JasmineReporters.reporter
-1572  *    Base object that will get called whenever a Spec, Suite, or Runner is done.  It is up to
-1573  *    descendants of this object to do something with the results (see json_reporter.js)
-1574  */
-1575 jasmine.Reporters = {};
-1576 
-1577 jasmine.Reporters.reporter = function(callbacks) {
-1578   var that = {
-1579     callbacks: callbacks || {},
-1580 
-1581     doCallback: function(callback, results) {
-1582       if (callback) {
-1583         callback(results);
-1584       }
-1585     },
-1586 
-1587     reportRunnerResults: function(runner) {
-1588       that.doCallback(that.callbacks.runnerCallback, runner);
-1589     },
-1590     reportSuiteResults:  function(suite) {
-1591       that.doCallback(that.callbacks.suiteCallback, suite);
-1592     },
-1593     reportSpecResults:   function(spec) {
-1594       that.doCallback(that.callbacks.specCallback, spec);
-1595     },
-1596     log: function (str) {
-1597       if (console && console.log) console.log(str);
-1598     }
-1599   };
-1600 
-1601   return that;
-1602 };
-1603 
-1604 /**
-1605  * Runner
-1606  *
-1607  * @constructor
-1608  * @param {jasmine.Env} env
-1609  */
-1610 jasmine.Runner = function(env) {
-1611   var self = this;
-1612   self.env = env;
-1613   self.queue = new jasmine.Queue(env);
-1614   self.before_ = [];
-1615   self.after_ = [];
-1616   self.suites_ = [];
-1617 };
-1618 
-1619 jasmine.Runner.prototype.execute = function() {
-1620   var self = this;
-1621   if (self.env.reporter.reportRunnerStarting) {
-1622     self.env.reporter.reportRunnerStarting(this);
-1623   }
-1624   self.queue.start(function () {
-1625     self.finishCallback();
-1626   });
-1627 };
-1628 
-1629 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
-1630   beforeEachFunction.typeName = 'beforeEach';
-1631   this.before_.push(beforeEachFunction);
-1632 };
-1633 
-1634 jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
-1635   afterEachFunction.typeName = 'afterEach';
-1636   this.after_.push(afterEachFunction);
-1637 };
-1638 
-1639 
-1640 jasmine.Runner.prototype.finishCallback = function() {
-1641   this.env.reporter.reportRunnerResults(this);
-1642 };
-1643 
-1644 jasmine.Runner.prototype.addSuite = function(suite) {
-1645   this.suites_.push(suite);
-1646 };
+1493 jasmine.Queue.prototype.addBefore = function(block) {
+1494   this.blocks.unshift(block);
+1495 };
+1496 
+1497 jasmine.Queue.prototype.add = function(block) {
+1498   this.blocks.push(block);
+1499 };
+1500 
+1501 jasmine.Queue.prototype.insertNext = function(block) {
+1502   this.blocks.splice((this.index + this.offset + 1), 0, block);
+1503   this.offset++;
+1504 };
+1505 
+1506 jasmine.Queue.prototype.start = function(onComplete) {
+1507   this.running = true;
+1508   this.onComplete = onComplete;
+1509   this.next_();
+1510 };
+1511 
+1512 jasmine.Queue.prototype.isRunning = function() {
+1513   return this.running;
+1514 };
+1515 
+1516 jasmine.Queue.LOOP_DONT_RECURSE = true;
+1517 
+1518 jasmine.Queue.prototype.next_ = function() {
+1519   var self = this;
+1520   var goAgain = true;
+1521 
+1522   while (goAgain) {
+1523     goAgain = false;
+1524     
+1525     if (self.index < self.blocks.length) {
+1526       var calledSynchronously = true;
+1527       var completedSynchronously = false;
+1528 
+1529       var onComplete = function () {
+1530         if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
+1531           completedSynchronously = true;
+1532           return;
+1533         }
+1534 
+1535         self.offset = 0;
+1536         self.index++;
+1537 
+1538         var now = new Date().getTime();
+1539         if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
+1540           self.env.lastUpdate = now;
+1541           self.env.setTimeout(function() {
+1542             self.next_();
+1543           }, 0);
+1544         } else {
+1545           if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
+1546             goAgain = true;
+1547           } else {
+1548             self.next_();
+1549           }
+1550         }
+1551       };
+1552       self.blocks[self.index].execute(onComplete);
+1553 
+1554       calledSynchronously = false;
+1555       if (completedSynchronously) {
+1556         onComplete();
+1557       }
+1558       
+1559     } else {
+1560       self.running = false;
+1561       if (self.onComplete) {
+1562         self.onComplete();
+1563       }
+1564     }
+1565   }
+1566 };
+1567 
+1568 jasmine.Queue.prototype.results = function() {
+1569   var results = new jasmine.NestedResults();
+1570   for (var i = 0; i < this.blocks.length; i++) {
+1571     if (this.blocks[i].results) {
+1572       results.addResult(this.blocks[i].results());
+1573     }
+1574   }
+1575   return results;
+1576 };
+1577 
+1578 
+1579 /* JasmineReporters.reporter
+1580  *    Base object that will get called whenever a Spec, Suite, or Runner is done.  It is up to
+1581  *    descendants of this object to do something with the results (see json_reporter.js)
+1582  */
+1583 jasmine.Reporters = {};
+1584 
+1585 jasmine.Reporters.reporter = function(callbacks) {
+1586   var that = {
+1587     callbacks: callbacks || {},
+1588 
+1589     doCallback: function(callback, results) {
+1590       if (callback) {
+1591         callback(results);
+1592       }
+1593     },
+1594 
+1595     reportRunnerResults: function(runner) {
+1596       that.doCallback(that.callbacks.runnerCallback, runner);
+1597     },
+1598     reportSuiteResults:  function(suite) {
+1599       that.doCallback(that.callbacks.suiteCallback, suite);
+1600     },
+1601     reportSpecResults:   function(spec) {
+1602       that.doCallback(that.callbacks.specCallback, spec);
+1603     },
+1604     log: function (str) {
+1605       if (console && console.log) console.log(str);
+1606     }
+1607   };
+1608 
+1609   return that;
+1610 };
+1611 
+1612 /**
+1613  * Runner
+1614  *
+1615  * @constructor
+1616  * @param {jasmine.Env} env
+1617  */
+1618 jasmine.Runner = function(env) {
+1619   var self = this;
+1620   self.env = env;
+1621   self.queue = new jasmine.Queue(env);
+1622   self.before_ = [];
+1623   self.after_ = [];
+1624   self.suites_ = [];
+1625 };
+1626 
+1627 jasmine.Runner.prototype.execute = function() {
+1628   var self = this;
+1629   if (self.env.reporter.reportRunnerStarting) {
+1630     self.env.reporter.reportRunnerStarting(this);
+1631   }
+1632   self.queue.start(function () {
+1633     self.finishCallback();
+1634   });
+1635 };
+1636 
+1637 jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
+1638   beforeEachFunction.typeName = 'beforeEach';
+1639   this.before_.push(beforeEachFunction);
+1640 };
+1641 
+1642 jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
+1643   afterEachFunction.typeName = 'afterEach';
+1644   this.after_.push(afterEachFunction);
+1645 };
+1646 
 1647 
-1648 jasmine.Runner.prototype.add = function(block) {
-1649   if (block instanceof jasmine.Suite) {
-1650     this.addSuite(block);
-1651   }
-1652   this.queue.add(block);
-1653 };
-1654 
-1655 /** @deprecated */
-1656 jasmine.Runner.prototype.getAllSuites = function() {
-1657   return this.suites_;
-1658 };
-1659 
-1660 
-1661 jasmine.Runner.prototype.suites = function() {
-1662   return this.suites_;
-1663 };
-1664 
-1665 jasmine.Runner.prototype.results = function() {
-1666   return this.queue.results();
-1667 };
-1668 
-1669 /** @deprecated */
-1670 jasmine.Runner.prototype.getResults = function() {
-1671   return this.queue.results();
-1672 };
-1673 /**
-1674  * Internal representation of a Jasmine specification, or test.
-1675  *
-1676  * @constructor
-1677  * @param {jasmine.Env} env
-1678  * @param {jasmine.Suite} suite
-1679  * @param {String} description
-1680  */
-1681 jasmine.Spec = function(env, suite, description) {
-1682   if (!env) {
-1683     throw new Error('jasmine.Env() required');
-1684   }
-1685   ;
-1686   if (!suite) {
-1687     throw new Error('jasmine.Suite() required');
-1688   }
-1689   ;
-1690   var spec = this;
-1691   spec.id = env.nextSpecId ? env.nextSpecId() : null;
-1692   spec.env = env;
-1693   spec.suite = suite;
-1694   spec.description = description;
-1695   spec.queue = new jasmine.Queue(env);
-1696 
-1697   spec.afterCallbacks = [];
-1698   spec.spies_ = [];
-1699 
-1700   spec.results_ = new jasmine.NestedResults();
-1701   spec.results_.description = description;
-1702   spec.matchersClass = null;
-1703 };
-1704 
-1705 jasmine.Spec.prototype.getFullName = function() {
-1706   return this.suite.getFullName() + ' ' + this.description + '.';
-1707 };
-1708 
-1709 
-1710 jasmine.Spec.prototype.results = function() {
-1711   return this.results_;
-1712 };
+1648 jasmine.Runner.prototype.finishCallback = function() {
+1649   this.env.reporter.reportRunnerResults(this);
+1650 };
+1651 
+1652 jasmine.Runner.prototype.addSuite = function(suite) {
+1653   this.suites_.push(suite);
+1654 };
+1655 
+1656 jasmine.Runner.prototype.add = function(block) {
+1657   if (block instanceof jasmine.Suite) {
+1658     this.addSuite(block);
+1659   }
+1660   this.queue.add(block);
+1661 };
+1662 
+1663 /** @deprecated */
+1664 jasmine.Runner.prototype.getAllSuites = function() {
+1665   return this.suites_;
+1666 };
+1667 
+1668 jasmine.Runner.prototype.specs = function () {
+1669   var suites = this.suites();
+1670   var specs = [];
+1671   for (var i = 0; i < suites.length; i++) {
+1672     specs = specs.concat(suites[i].specs());
+1673   }
+1674   return specs;
+1675 };
+1676 
+1677 
+1678 jasmine.Runner.prototype.suites = function() {
+1679   return this.suites_;
+1680 };
+1681 
+1682 jasmine.Runner.prototype.results = function() {
+1683   return this.queue.results();
+1684 };
+1685 
+1686 /** @deprecated */
+1687 jasmine.Runner.prototype.getResults = function() {
+1688   return this.queue.results();
+1689 };
+1690 /**
+1691  * Internal representation of a Jasmine specification, or test.
+1692  *
+1693  * @constructor
+1694  * @param {jasmine.Env} env
+1695  * @param {jasmine.Suite} suite
+1696  * @param {String} description
+1697  */
+1698 jasmine.Spec = function(env, suite, description) {
+1699   if (!env) {
+1700     throw new Error('jasmine.Env() required');
+1701   }
+1702   ;
+1703   if (!suite) {
+1704     throw new Error('jasmine.Suite() required');
+1705   }
+1706   ;
+1707   var spec = this;
+1708   spec.id = env.nextSpecId ? env.nextSpecId() : null;
+1709   spec.env = env;
+1710   spec.suite = suite;
+1711   spec.description = description;
+1712   spec.queue = new jasmine.Queue(env);
 1713 
-1714 jasmine.Spec.prototype.log = function(message) {
-1715   return this.results_.log(message);
-1716 };
-1717 
-1718 /** @deprecated */
-1719 jasmine.Spec.prototype.getResults = function() {
-1720   return this.results_;
-1721 };
-1722 
-1723 jasmine.Spec.prototype.runs = function (func) {
-1724   var block = new jasmine.Block(this.env, func, this);
-1725   this.addToQueue(block);
-1726   return this;
-1727 };
-1728 
-1729 jasmine.Spec.prototype.addToQueue = function (block) {
-1730   if (this.queue.isRunning()) {
-1731     this.queue.insertNext(block);
-1732   } else {
-1733     this.queue.add(block);
-1734   }
-1735 };
-1736 
-1737 /**
-1738  * @private
-1739  * @deprecated
-1740  */
-1741 jasmine.Spec.prototype.expects_that = function(actual) {
-1742   return this.expect(actual);
-1743 };
-1744 
-1745 jasmine.Spec.prototype.expect = function(actual) {
-1746   return new (this.getMatchersClass_())(this.env, actual, this.results_);
-1747 };
-1748 
-1749 jasmine.Spec.prototype.waits = function(timeout) {
-1750   var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
-1751   this.addToQueue(waitsFunc);
-1752   return this;
-1753 };
-1754 
-1755 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
-1756   var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
-1757   this.addToQueue(waitsForFunc);
-1758   return this;
-1759 };
-1760 
-1761 jasmine.Spec.prototype.fail = function (e) {
-1762   this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
-1763 };
-1764 
-1765 jasmine.Spec.prototype.getMatchersClass_ = function() {
-1766   return this.matchersClass || jasmine.Matchers;
-1767 };
-1768 
-1769 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
-1770   var parent = this.getMatchersClass_();
-1771   var newMatchersClass = function() {
-1772     parent.apply(this, arguments);
-1773   };
-1774   jasmine.util.inherit(newMatchersClass, parent);
-1775   for (var method in matchersPrototype) {
-1776     newMatchersClass.prototype[method] = matchersPrototype[method];
-1777   }
-1778   this.matchersClass = newMatchersClass;
-1779 };
-1780 
-1781 jasmine.Spec.prototype.finishCallback = function() {
-1782   this.env.reporter.reportSpecResults(this);
-1783 };
-1784 
-1785 jasmine.Spec.prototype.finish = function(onComplete) {
-1786   this.removeAllSpies();
-1787   this.finishCallback();
-1788   if (onComplete) {
-1789     onComplete();
-1790   }
-1791 };
-1792 
-1793 jasmine.Spec.prototype.after = function(doAfter, test) {
-1794 
-1795   if (this.queue.isRunning()) {
-1796     this.queue.add(new jasmine.Block(this.env, doAfter, this));
-1797   } else {
-1798     this.afterCallbacks.unshift(doAfter);
-1799   }
+1714   spec.afterCallbacks = [];
+1715   spec.spies_ = [];
+1716 
+1717   spec.results_ = new jasmine.NestedResults();
+1718   spec.results_.description = description;
+1719   spec.matchersClass = null;
+1720 };
+1721 
+1722 jasmine.Spec.prototype.getFullName = function() {
+1723   return this.suite.getFullName() + ' ' + this.description + '.';
+1724 };
+1725 
+1726 
+1727 jasmine.Spec.prototype.results = function() {
+1728   return this.results_;
+1729 };
+1730 
+1731 jasmine.Spec.prototype.log = function(message) {
+1732   return this.results_.log(message);
+1733 };
+1734 
+1735 /** @deprecated */
+1736 jasmine.Spec.prototype.getResults = function() {
+1737   return this.results_;
+1738 };
+1739 
+1740 jasmine.Spec.prototype.runs = function (func) {
+1741   var block = new jasmine.Block(this.env, func, this);
+1742   this.addToQueue(block);
+1743   return this;
+1744 };
+1745 
+1746 jasmine.Spec.prototype.addToQueue = function (block) {
+1747   if (this.queue.isRunning()) {
+1748     this.queue.insertNext(block);
+1749   } else {
+1750     this.queue.add(block);
+1751   }
+1752 };
+1753 
+1754 /**
+1755  * @private
+1756  * @deprecated
+1757  */
+1758 jasmine.Spec.prototype.expects_that = function(actual) {
+1759   return this.expect(actual);
+1760 };
+1761 
+1762 jasmine.Spec.prototype.expect = function(actual) {
+1763   return new (this.getMatchersClass_())(this.env, actual, this.results_);
+1764 };
+1765 
+1766 jasmine.Spec.prototype.waits = function(timeout) {
+1767   var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
+1768   this.addToQueue(waitsFunc);
+1769   return this;
+1770 };
+1771 
+1772 jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
+1773   var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
+1774   this.addToQueue(waitsForFunc);
+1775   return this;
+1776 };
+1777 
+1778 jasmine.Spec.prototype.fail = function (e) {
+1779   this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
+1780 };
+1781 
+1782 jasmine.Spec.prototype.getMatchersClass_ = function() {
+1783   return this.matchersClass || jasmine.Matchers;
+1784 };
+1785 
+1786 jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
+1787   var parent = this.getMatchersClass_();
+1788   var newMatchersClass = function() {
+1789     parent.apply(this, arguments);
+1790   };
+1791   jasmine.util.inherit(newMatchersClass, parent);
+1792   for (var method in matchersPrototype) {
+1793     newMatchersClass.prototype[method] = matchersPrototype[method];
+1794   }
+1795   this.matchersClass = newMatchersClass;
+1796 };
+1797 
+1798 jasmine.Spec.prototype.finishCallback = function() {
+1799   this.env.reporter.reportSpecResults(this);
 1800 };
 1801 
-1802 jasmine.Spec.prototype.execute = function(onComplete) {
-1803   var spec = this;
-1804   if (!spec.env.specFilter(spec)) {
-1805     spec.results_.skipped = true;
-1806     spec.finish(onComplete);
-1807     return;
-1808   }
-1809   this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
-1810 
-1811   spec.env.currentSpec = spec;
-1812   spec.env.currentlyRunningTests = true;
-1813 
-1814   spec.addBeforesAndAftersToQueue();
-1815 
-1816   spec.queue.start(function () {
-1817     spec.finish(onComplete);
-1818   });
-1819   spec.env.currentlyRunningTests = false;
-1820 };
-1821 
-1822 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
-1823   var runner = this.env.currentRunner();
-1824   for (var suite = this.suite; suite; suite = suite.parentSuite) {
-1825     for (var i = 0; i < suite.before_.length; i++) {
-1826       this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
-1827     }
-1828   }
-1829   for (var i = 0; i < runner.before_.length; i++) {
-1830     this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
-1831   }
-1832   for (i = 0; i < this.afterCallbacks.length; i++) {
-1833     this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
-1834   }
-1835   for (suite = this.suite; suite; suite = suite.parentSuite) {
-1836     for (var i = 0; i < suite.after_.length; i++) {
-1837       this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
-1838     }
-1839   }
-1840   for (var i = 0; i < runner.after_.length; i++) {
-1841     this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
-1842   }
-1843 };
-1844 
-1845 jasmine.Spec.prototype.explodes = function() {
-1846   throw 'explodes function should not have been called';
-1847 };
-1848 
-1849 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
-1850   if (obj == undefined) {
-1851     throw "spyOn could not find an object to spy upon for " + methodName + "()";
-1852   }
-1853 
-1854   if (!ignoreMethodDoesntExist && obj[methodName] === undefined) {
-1855     throw methodName + '() method does not exist';
+1802 jasmine.Spec.prototype.finish = function(onComplete) {
+1803   this.removeAllSpies();
+1804   this.finishCallback();
+1805   if (onComplete) {
+1806     onComplete();
+1807   }
+1808 };
+1809 
+1810 jasmine.Spec.prototype.after = function(doAfter, test) {
+1811 
+1812   if (this.queue.isRunning()) {
+1813     this.queue.add(new jasmine.Block(this.env, doAfter, this));
+1814   } else {
+1815     this.afterCallbacks.unshift(doAfter);
+1816   }
+1817 };
+1818 
+1819 jasmine.Spec.prototype.execute = function(onComplete) {
+1820   var spec = this;
+1821   if (!spec.env.specFilter(spec)) {
+1822     spec.results_.skipped = true;
+1823     spec.finish(onComplete);
+1824     return;
+1825   }
+1826   this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
+1827 
+1828   spec.env.currentSpec = spec;
+1829   spec.env.currentlyRunningTests = true;
+1830 
+1831   spec.addBeforesAndAftersToQueue();
+1832 
+1833   spec.queue.start(function () {
+1834     spec.finish(onComplete);
+1835   });
+1836   spec.env.currentlyRunningTests = false;
+1837 };
+1838 
+1839 jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
+1840   var runner = this.env.currentRunner();
+1841   for (var suite = this.suite; suite; suite = suite.parentSuite) {
+1842     for (var i = 0; i < suite.before_.length; i++) {
+1843       this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
+1844     }
+1845   }
+1846   for (var i = 0; i < runner.before_.length; i++) {
+1847     this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
+1848   }
+1849   for (i = 0; i < this.afterCallbacks.length; i++) {
+1850     this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
+1851   }
+1852   for (suite = this.suite; suite; suite = suite.parentSuite) {
+1853     for (var i = 0; i < suite.after_.length; i++) {
+1854       this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
+1855     }
 1856   }
-1857 
-1858   if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
-1859     throw new Error(methodName + ' has already been spied upon');
-1860   }
+1857   for (var i = 0; i < runner.after_.length; i++) {
+1858     this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
+1859   }
+1860 };
 1861 
-1862   var spyObj = jasmine.createSpy(methodName);
-1863 
-1864   this.spies_.push(spyObj);
-1865   spyObj.baseObj = obj;
-1866   spyObj.methodName = methodName;
-1867   spyObj.originalValue = obj[methodName];
-1868 
-1869   obj[methodName] = spyObj;
+1862 jasmine.Spec.prototype.explodes = function() {
+1863   throw 'explodes function should not have been called';
+1864 };
+1865 
+1866 jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
+1867   if (obj == undefined) {
+1868     throw "spyOn could not find an object to spy upon for " + methodName + "()";
+1869   }
 1870 
-1871   return spyObj;
-1872 };
-1873 
-1874 jasmine.Spec.prototype.removeAllSpies = function() {
-1875   for (var i = 0; i < this.spies_.length; i++) {
-1876     var spy = this.spies_[i];
-1877     spy.baseObj[spy.methodName] = spy.originalValue;
-1878   }
-1879   this.spies_ = [];
-1880 };
-1881 
-1882 /**
-1883  * Internal representation of a Jasmine suite.
-1884  *
-1885  * @constructor
-1886  * @param {jasmine.Env} env
-1887  * @param {String} description
-1888  * @param {Function} specDefinitions
-1889  * @param {jasmine.Suite} parentSuite
-1890  */
-1891 jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
-1892   var self = this;
-1893   self.id = env.nextSuiteId ? env.nextSuiteId() : null;
-1894   self.description = description;
-1895   self.queue = new jasmine.Queue(env);
-1896   self.parentSuite = parentSuite;
-1897   self.env = env;
-1898   self.before_ = [];
-1899   self.after_ = [];
-1900   self.specs_ = [];
-1901 };
-1902 
-1903 jasmine.Suite.prototype.getFullName = function() {
-1904   var fullName = this.description;
-1905   for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
-1906     fullName = parentSuite.description + ' ' + fullName;
-1907   }
-1908   return fullName;
-1909 };
-1910 
-1911 jasmine.Suite.prototype.finish = function(onComplete) {
-1912   this.env.reporter.reportSuiteResults(this);
-1913   this.finished = true;
-1914   if (typeof(onComplete) == 'function') {
-1915     onComplete();
-1916   }
-1917 };
-1918 
-1919 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
-1920   beforeEachFunction.typeName = 'beforeEach';
-1921   this.before_.push(beforeEachFunction);
-1922 };
-1923 
-1924 jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
-1925   afterEachFunction.typeName = 'afterEach';
-1926   this.after_.push(afterEachFunction);
-1927 };
-1928 
-1929 /** @deprecated */
-1930 jasmine.Suite.prototype.getResults = function() {
-1931   return this.queue.results();
-1932 };
-1933 
-1934 jasmine.Suite.prototype.results = function() {
-1935   return this.queue.results();
-1936 };
-1937 
-1938 jasmine.Suite.prototype.add = function(block) {
-1939   if (block instanceof jasmine.Suite) {
-1940     this.env.currentRunner().addSuite(block);
-1941   } else {
-1942     this.specs_.push(block);
-1943   }
-1944   this.queue.add(block);
-1945 };
-1946 
-1947 /** @deprecated */
-1948 jasmine.Suite.prototype.specCount = function() {
-1949   return this.specs_.length;
-1950 };
-1951 
-1952 jasmine.Suite.prototype.specs = function() {
-1953   return this.specs_;
-1954 };
-1955 
-1956 jasmine.Suite.prototype.execute = function(onComplete) {
-1957   var self = this;
-1958   this.queue.start(function () {
-1959     self.finish(onComplete);
-1960   });
-1961 };
-1962 jasmine.WaitsBlock = function(env, timeout, spec) {
-1963   this.timeout = timeout;
-1964   jasmine.Block.call(this, env, null, spec);
-1965 };
-1966 
-1967 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
+1871   if (!ignoreMethodDoesntExist && obj[methodName] === undefined) {
+1872     throw methodName + '() method does not exist';
+1873   }
+1874 
+1875   if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
+1876     throw new Error(methodName + ' has already been spied upon');
+1877   }
+1878 
+1879   var spyObj = jasmine.createSpy(methodName);
+1880 
+1881   this.spies_.push(spyObj);
+1882   spyObj.baseObj = obj;
+1883   spyObj.methodName = methodName;
+1884   spyObj.originalValue = obj[methodName];
+1885 
+1886   obj[methodName] = spyObj;
+1887 
+1888   return spyObj;
+1889 };
+1890 
+1891 jasmine.Spec.prototype.removeAllSpies = function() {
+1892   for (var i = 0; i < this.spies_.length; i++) {
+1893     var spy = this.spies_[i];
+1894     spy.baseObj[spy.methodName] = spy.originalValue;
+1895   }
+1896   this.spies_ = [];
+1897 };
+1898 
+1899 /**
+1900  * Internal representation of a Jasmine suite.
+1901  *
+1902  * @constructor
+1903  * @param {jasmine.Env} env
+1904  * @param {String} description
+1905  * @param {Function} specDefinitions
+1906  * @param {jasmine.Suite} parentSuite
+1907  */
+1908 jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
+1909   var self = this;
+1910   self.id = env.nextSuiteId ? env.nextSuiteId() : null;
+1911   self.description = description;
+1912   self.queue = new jasmine.Queue(env);
+1913   self.parentSuite = parentSuite;
+1914   self.env = env;
+1915   self.before_ = [];
+1916   self.after_ = [];
+1917   self.specs_ = [];
+1918 };
+1919 
+1920 jasmine.Suite.prototype.getFullName = function() {
+1921   var fullName = this.description;
+1922   for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
+1923     fullName = parentSuite.description + ' ' + fullName;
+1924   }
+1925   return fullName;
+1926 };
+1927 
+1928 jasmine.Suite.prototype.finish = function(onComplete) {
+1929   this.env.reporter.reportSuiteResults(this);
+1930   this.finished = true;
+1931   if (typeof(onComplete) == 'function') {
+1932     onComplete();
+1933   }
+1934 };
+1935 
+1936 jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
+1937   beforeEachFunction.typeName = 'beforeEach';
+1938   this.before_.push(beforeEachFunction);
+1939 };
+1940 
+1941 jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
+1942   afterEachFunction.typeName = 'afterEach';
+1943   this.after_.push(afterEachFunction);
+1944 };
+1945 
+1946 /** @deprecated */
+1947 jasmine.Suite.prototype.getResults = function() {
+1948   return this.queue.results();
+1949 };
+1950 
+1951 jasmine.Suite.prototype.results = function() {
+1952   return this.queue.results();
+1953 };
+1954 
+1955 jasmine.Suite.prototype.add = function(block) {
+1956   if (block instanceof jasmine.Suite) {
+1957     this.env.currentRunner().addSuite(block);
+1958   } else {
+1959     this.specs_.push(block);
+1960   }
+1961   this.queue.add(block);
+1962 };
+1963 
+1964 /** @deprecated */
+1965 jasmine.Suite.prototype.specCount = function() {
+1966   return this.specs_.length;
+1967 };
 1968 
-1969 jasmine.WaitsBlock.prototype.execute = function (onComplete) {
-1970   this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
-1971   this.env.setTimeout(function () {
-1972     onComplete();
-1973   }, this.timeout);
-1974 };
-1975 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
-1976   this.timeout = timeout;
-1977   this.latchFunction = latchFunction;
-1978   this.message = message;
-1979   this.totalTimeSpentWaitingForLatch = 0;
-1980   jasmine.Block.call(this, env, null, spec);
-1981 };
-1982 
-1983 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
-1984 
-1985 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100;
-1986 
-1987 jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
-1988   var self = this;
-1989   self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen'));
-1990   var latchFunctionResult;
-1991   try {
-1992     latchFunctionResult = self.latchFunction.apply(self.spec);
-1993   } catch (e) {
-1994     self.spec.fail(e);
-1995     onComplete();
-1996     return;
-1997   }
-1998 
-1999   if (latchFunctionResult) {
-2000     onComplete();
-2001   } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
-2002     var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
-2003     self.spec.fail({
-2004       name: 'timeout',
-2005       message: message
-2006     });
-2007     self.spec._next();
-2008   } else {
-2009     self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
-2010     self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
-2011   }
-2012 };
-2013 // Mock setTimeout, clearTimeout
-2014 // Contributed by Pivotal Computer Systems, www.pivotalsf.com
-2015 
-2016 jasmine.FakeTimer = function() {
-2017   this.reset();
-2018 
-2019   var self = this;
-2020   self.setTimeout = function(funcToCall, millis) {
-2021     self.timeoutsMade++;
-2022     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
-2023     return self.timeoutsMade;
-2024   };
-2025 
-2026   self.setInterval = function(funcToCall, millis) {
-2027     self.timeoutsMade++;
-2028     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
-2029     return self.timeoutsMade;
-2030   };
-2031 
-2032   self.clearTimeout = function(timeoutKey) {
-2033     self.scheduledFunctions[timeoutKey] = undefined;
-2034   };
+1969 jasmine.Suite.prototype.specs = function() {
+1970   return this.specs_;
+1971 };
+1972 
+1973 jasmine.Suite.prototype.execute = function(onComplete) {
+1974   var self = this;
+1975   this.queue.start(function () {
+1976     self.finish(onComplete);
+1977   });
+1978 };
+1979 jasmine.WaitsBlock = function(env, timeout, spec) {
+1980   this.timeout = timeout;
+1981   jasmine.Block.call(this, env, null, spec);
+1982 };
+1983 
+1984 jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
+1985 
+1986 jasmine.WaitsBlock.prototype.execute = function (onComplete) {
+1987   this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
+1988   this.env.setTimeout(function () {
+1989     onComplete();
+1990   }, this.timeout);
+1991 };
+1992 jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
+1993   this.timeout = timeout;
+1994   this.latchFunction = latchFunction;
+1995   this.message = message;
+1996   this.totalTimeSpentWaitingForLatch = 0;
+1997   jasmine.Block.call(this, env, null, spec);
+1998 };
+1999 
+2000 jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
+2001 
+2002 jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100;
+2003 
+2004 jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
+2005   var self = this;
+2006   self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen'));
+2007   var latchFunctionResult;
+2008   try {
+2009     latchFunctionResult = self.latchFunction.apply(self.spec);
+2010   } catch (e) {
+2011     self.spec.fail(e);
+2012     onComplete();
+2013     return;
+2014   }
+2015 
+2016   if (latchFunctionResult) {
+2017     onComplete();
+2018   } else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
+2019     var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
+2020     self.spec.fail({
+2021       name: 'timeout',
+2022       message: message
+2023     });
+2024     self.spec._next();
+2025   } else {
+2026     self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
+2027     self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
+2028   }
+2029 };
+2030 // Mock setTimeout, clearTimeout
+2031 // Contributed by Pivotal Computer Systems, www.pivotalsf.com
+2032 
+2033 jasmine.FakeTimer = function() {
+2034   this.reset();
 2035 
-2036   self.clearInterval = function(timeoutKey) {
-2037     self.scheduledFunctions[timeoutKey] = undefined;
-2038   };
-2039 
-2040 };
-2041 
-2042 jasmine.FakeTimer.prototype.reset = function() {
-2043   this.timeoutsMade = 0;
-2044   this.scheduledFunctions = {};
-2045   this.nowMillis = 0;
-2046 };
-2047 
-2048 jasmine.FakeTimer.prototype.tick = function(millis) {
-2049   var oldMillis = this.nowMillis;
-2050   var newMillis = oldMillis + millis;
-2051   this.runFunctionsWithinRange(oldMillis, newMillis);
-2052   this.nowMillis = newMillis;
-2053 };
-2054 
-2055 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
-2056   var scheduledFunc;
-2057   var funcsToRun = [];
-2058   for (var timeoutKey in this.scheduledFunctions) {
-2059     scheduledFunc = this.scheduledFunctions[timeoutKey];
-2060     if (scheduledFunc != undefined &&
-2061         scheduledFunc.runAtMillis >= oldMillis &&
-2062         scheduledFunc.runAtMillis <= nowMillis) {
-2063       funcsToRun.push(scheduledFunc);
-2064       this.scheduledFunctions[timeoutKey] = undefined;
-2065     }
-2066   }
-2067 
-2068   if (funcsToRun.length > 0) {
-2069     funcsToRun.sort(function(a, b) {
-2070       return a.runAtMillis - b.runAtMillis;
-2071     });
-2072     for (var i = 0; i < funcsToRun.length; ++i) {
-2073       try {
-2074         var funcToRun = funcsToRun[i];
-2075         this.nowMillis = funcToRun.runAtMillis;
-2076         funcToRun.funcToCall();
-2077         if (funcToRun.recurring) {
-2078           this.scheduleFunction(funcToRun.timeoutKey,
-2079             funcToRun.funcToCall,
-2080             funcToRun.millis,
-2081             true);
-2082         }
-2083       } catch(e) {
-2084       }
-2085     }
-2086     this.runFunctionsWithinRange(oldMillis, nowMillis);
-2087   }
-2088 };
-2089 
-2090 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
-2091   this.scheduledFunctions[timeoutKey] = {
-2092     runAtMillis: this.nowMillis + millis,
-2093     funcToCall: funcToCall,
-2094     recurring: recurring,
-2095     timeoutKey: timeoutKey,
-2096     millis: millis
-2097   };
-2098 };
-2099 
-2100 
-2101 jasmine.Clock = {
-2102   defaultFakeTimer: new jasmine.FakeTimer(),
-2103 
-2104   reset: function() {
-2105     jasmine.Clock.assertInstalled();
-2106     jasmine.Clock.defaultFakeTimer.reset();
-2107   },
-2108 
-2109   tick: function(millis) {
-2110     jasmine.Clock.assertInstalled();
-2111     jasmine.Clock.defaultFakeTimer.tick(millis);
-2112   },
-2113 
-2114   runFunctionsWithinRange: function(oldMillis, nowMillis) {
-2115     jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
-2116   },
+2036   var self = this;
+2037   self.setTimeout = function(funcToCall, millis) {
+2038     self.timeoutsMade++;
+2039     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
+2040     return self.timeoutsMade;
+2041   };
+2042 
+2043   self.setInterval = function(funcToCall, millis) {
+2044     self.timeoutsMade++;
+2045     self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
+2046     return self.timeoutsMade;
+2047   };
+2048 
+2049   self.clearTimeout = function(timeoutKey) {
+2050     self.scheduledFunctions[timeoutKey] = undefined;
+2051   };
+2052 
+2053   self.clearInterval = function(timeoutKey) {
+2054     self.scheduledFunctions[timeoutKey] = undefined;
+2055   };
+2056 
+2057 };
+2058 
+2059 jasmine.FakeTimer.prototype.reset = function() {
+2060   this.timeoutsMade = 0;
+2061   this.scheduledFunctions = {};
+2062   this.nowMillis = 0;
+2063 };
+2064 
+2065 jasmine.FakeTimer.prototype.tick = function(millis) {
+2066   var oldMillis = this.nowMillis;
+2067   var newMillis = oldMillis + millis;
+2068   this.runFunctionsWithinRange(oldMillis, newMillis);
+2069   this.nowMillis = newMillis;
+2070 };
+2071 
+2072 jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
+2073   var scheduledFunc;
+2074   var funcsToRun = [];
+2075   for (var timeoutKey in this.scheduledFunctions) {
+2076     scheduledFunc = this.scheduledFunctions[timeoutKey];
+2077     if (scheduledFunc != undefined &&
+2078         scheduledFunc.runAtMillis >= oldMillis &&
+2079         scheduledFunc.runAtMillis <= nowMillis) {
+2080       funcsToRun.push(scheduledFunc);
+2081       this.scheduledFunctions[timeoutKey] = undefined;
+2082     }
+2083   }
+2084 
+2085   if (funcsToRun.length > 0) {
+2086     funcsToRun.sort(function(a, b) {
+2087       return a.runAtMillis - b.runAtMillis;
+2088     });
+2089     for (var i = 0; i < funcsToRun.length; ++i) {
+2090       try {
+2091         var funcToRun = funcsToRun[i];
+2092         this.nowMillis = funcToRun.runAtMillis;
+2093         funcToRun.funcToCall();
+2094         if (funcToRun.recurring) {
+2095           this.scheduleFunction(funcToRun.timeoutKey,
+2096             funcToRun.funcToCall,
+2097             funcToRun.millis,
+2098             true);
+2099         }
+2100       } catch(e) {
+2101       }
+2102     }
+2103     this.runFunctionsWithinRange(oldMillis, nowMillis);
+2104   }
+2105 };
+2106 
+2107 jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
+2108   this.scheduledFunctions[timeoutKey] = {
+2109     runAtMillis: this.nowMillis + millis,
+2110     funcToCall: funcToCall,
+2111     recurring: recurring,
+2112     timeoutKey: timeoutKey,
+2113     millis: millis
+2114   };
+2115 };
+2116 
 2117 
-2118   scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
-2119     jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
-2120   },
-2121 
-2122   useMock: function() {
-2123     var spec = jasmine.getEnv().currentSpec;
-2124     spec.after(jasmine.Clock.uninstallMock);
+2118 jasmine.Clock = {
+2119   defaultFakeTimer: new jasmine.FakeTimer(),
+2120 
+2121   reset: function() {
+2122     jasmine.Clock.assertInstalled();
+2123     jasmine.Clock.defaultFakeTimer.reset();
+2124   },
 2125 
-2126     jasmine.Clock.installMock();
-2127   },
-2128 
-2129   installMock: function() {
-2130     jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
-2131   },
-2132 
-2133   uninstallMock: function() {
-2134     jasmine.Clock.assertInstalled();
-2135     jasmine.Clock.installed = jasmine.Clock.real;
-2136   },
-2137 
-2138   real: {
-2139     setTimeout: window.setTimeout,
-2140     clearTimeout: window.clearTimeout,
-2141     setInterval: window.setInterval,
-2142     clearInterval: window.clearInterval
-2143   },
-2144 
-2145   assertInstalled: function() {
-2146     if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
-2147       throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
-2148     }
-2149   },  
-2150 
-2151   installed: null
-2152 };
-2153 jasmine.Clock.installed = jasmine.Clock.real;
+2126   tick: function(millis) {
+2127     jasmine.Clock.assertInstalled();
+2128     jasmine.Clock.defaultFakeTimer.tick(millis);
+2129   },
+2130 
+2131   runFunctionsWithinRange: function(oldMillis, nowMillis) {
+2132     jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
+2133   },
+2134 
+2135   scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
+2136     jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
+2137   },
+2138 
+2139   useMock: function() {
+2140     var spec = jasmine.getEnv().currentSpec;
+2141     spec.after(jasmine.Clock.uninstallMock);
+2142 
+2143     jasmine.Clock.installMock();
+2144   },
+2145 
+2146   installMock: function() {
+2147     jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
+2148   },
+2149 
+2150   uninstallMock: function() {
+2151     jasmine.Clock.assertInstalled();
+2152     jasmine.Clock.installed = jasmine.Clock.real;
+2153   },
 2154 
-2155 window.setTimeout = function(funcToCall, millis) {
-2156   return jasmine.Clock.installed.setTimeout.apply(this, arguments);
-2157 };
-2158 
-2159 window.setInterval = function(funcToCall, millis) {
-2160   return jasmine.Clock.installed.setInterval.apply(this, arguments);
-2161 };
-2162 
-2163 window.clearTimeout = function(timeoutKey) {
-2164   return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
-2165 };
-2166 
-2167 window.clearInterval = function(timeoutKey) {
-2168   return jasmine.Clock.installed.clearInterval.apply(this, arguments);
+2155   real: {
+2156     setTimeout: window.setTimeout,
+2157     clearTimeout: window.clearTimeout,
+2158     setInterval: window.setInterval,
+2159     clearInterval: window.clearInterval
+2160   },
+2161 
+2162   assertInstalled: function() {
+2163     if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
+2164       throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
+2165     }
+2166   },
+2167 
+2168   installed: null
 2169 };
-2170 
-2171 
\ No newline at end of file +2170 jasmine.Clock.installed = jasmine.Clock.real; +2171 +2172 //else for IE support +2173 window.setTimeout = function(funcToCall, millis) { +2174 if (jasmine.Clock.installed.setTimeout.apply) { +2175 return jasmine.Clock.installed.setTimeout.apply(this, arguments); +2176 } else { +2177 return jasmine.Clock.installed.setTimeout(funcToCall, millis); +2178 } +2179 }; +2180 +2181 window.setInterval = function(funcToCall, millis) { +2182 if (jasmine.Clock.installed.setInterval.apply) { +2183 return jasmine.Clock.installed.setInterval.apply(this, arguments); +2184 } else { +2185 return jasmine.Clock.installed.setInterval(funcToCall, millis); +2186 } +2187 }; +2188 +2189 window.clearTimeout = function(timeoutKey) { +2190 if (jasmine.Clock.installed.clearTimeout.apply) { +2191 return jasmine.Clock.installed.clearTimeout.apply(this, arguments); +2192 } else { +2193 return jasmine.Clock.installed.clearTimeout(timeoutKey); +2194 } +2195 }; +2196 +2197 window.clearInterval = function(timeoutKey) { +2198 if (jasmine.Clock.installed.clearTimeout.apply) { +2199 return jasmine.Clock.installed.clearInterval.apply(this, arguments); +2200 } else { +2201 return jasmine.Clock.installed.clearInterval(timeoutKey); +2202 } +2203 }; +2204 +2205 \ No newline at end of file diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 13cd3bc..81e3e79 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -39,7 +39,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { var suite = suites[i]; var suiteDiv = this.createDom('div', { className: 'suite' }, this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - suite.description); + this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); this.suiteDivs[suite.getFullName()] = suiteDiv; var parentDiv = this.document.body; if (suite.parentSuite) { @@ -55,9 +55,16 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { var results = runner.results(); var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; this.runnerDiv.setAttribute("class", className); - var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); + var specs = runner.specs(); + var specCount = 0; + for (var i = 0; i < specs.length; i++) { + if (this.specFilter(specs[i])) { + specCount++; + } + } + var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.document.createTextNode(message), this.runnerMessageSpan.firstChild); + this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { @@ -77,7 +84,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { } var specDiv = this.createDom('div', { className: 'spec ' + status }, this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - spec.getFullName()); + this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName())); var resultItems = results.getItems(); diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index 70d7086..e957838 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -530,7 +530,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1255654784 + "revision": 1255658178 }; /** * @namespace @@ -1665,6 +1665,15 @@ jasmine.Runner.prototype.getAllSuites = function() { return this.suites_; }; +jasmine.Runner.prototype.specs = function () { + var suites = this.suites(); + var specs = []; + for (var i = 0; i < suites.length; i++) { + specs = specs.concat(suites[i].specs()); + } + return specs; +}; + jasmine.Runner.prototype.suites = function() { return this.suites_; diff --git a/spec/suites/EnvSpec.js b/spec/suites/EnvSpec.js index cd6aa8f..a0f2032 100644 --- a/spec/suites/EnvSpec.js +++ b/spec/suites/EnvSpec.js @@ -13,11 +13,6 @@ describe("jasmine.Env", function() { expect(env.nextSpecId()).toEqual(2); }); - it('nextSuiteId should return consecutive integers, starting at 0', function () { - expect(env.nextSuiteId()).toEqual(0); - expect(env.nextSuiteId()).toEqual(1); - expect(env.nextSuiteId()).toEqual(2); - }); }); describe("reporting", function() { var fakeReporter; diff --git a/spec/suites/RunnerSpec.js b/spec/suites/RunnerSpec.js index 319b6af..1d28ad2 100644 --- a/spec/suites/RunnerSpec.js +++ b/spec/suites/RunnerSpec.js @@ -33,8 +33,8 @@ describe('RunnerTest', function() { env.describe('suite 2', function () { env.it('test 2-1', function() { - foo++; - this.expect(foo).toEqual(1); + foo++; + this.expect(foo).toEqual(1); }); }); @@ -44,9 +44,40 @@ describe('RunnerTest', function() { expect(runnerResults.totalCount).toEqual(3); expect(runnerResults.passedCount).toEqual(3); }); + + + it('should provide all specs', function () { + var foo; + env.beforeEach(function () { + foo = 0; + }); + + env.describe('suite 1', function () { + env.it('test 1-1', function() { + foo++; + this.expect(foo).toEqual(1); + }); + env.it('test 1-2', function() { + foo++; + this.expect(foo).toEqual(1); + }); + }); + + env.describe('suite 2', function () { + env.it('test 2-1', function() { + foo++; + this.expect(foo).toEqual(1); + }); + }); + + env.currentRunner().execute(); + + + expect(env.currentRunner().specs().length).toEqual(3); + }); }); - describe('afterEach', function() { + describe('afterEach', function() { it('should run after each spec for all suites', function () { var foo = 3; env.afterEach(function () { @@ -64,7 +95,7 @@ describe('RunnerTest', function() { env.describe('suite 2', function () { env.it('test 2-1', function() { - this.expect(foo).toEqual(1); + this.expect(foo).toEqual(1); }); }); diff --git a/src/Runner.js b/src/Runner.js index 727c8bf..eb987f2 100644 --- a/src/Runner.js +++ b/src/Runner.js @@ -54,6 +54,15 @@ jasmine.Runner.prototype.getAllSuites = function() { return this.suites_; }; +jasmine.Runner.prototype.specs = function () { + var suites = this.suites(); + var specs = []; + for (var i = 0; i < suites.length; i++) { + specs = specs.concat(suites[i].specs()); + } + return specs; +}; + jasmine.Runner.prototype.suites = function() { return this.suites_; From d222855cc843a9abf5e95c40b3d569a2abe4f3b2 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 20:00:41 -0700 Subject: [PATCH 16/18] TrivialReporter IE compatibility --- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_TrivialReporter.js.html | 218 ++++++++++---------- doc/symbols/src/lib_jasmine-0.9.0.js.html | 2 +- lib/TrivialReporter.js | 10 +- lib/jasmine-0.9.0.js | 2 +- lib/jasmine.css | 54 ++--- 20 files changed, 154 insertions(+), 162 deletions(-) diff --git a/doc/files.html b/doc/files.html index cdf93ee..e414f84 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index 8c42d87..5f76f46 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index be01800..804f25e 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index 1288870..7bbb432 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 5007a98..2a4c65a 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index 88f6187..b377e65 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 8a223a4..3bd08e5 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 33a4c8f..24f5547 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index 9934204..ea615fb 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 8809683..35adb7a 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 3175a60..1d0f210 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index 1fd20af..4cc7f9b 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index 5d6f34a..dcb7998 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index fb0a17c..262de77 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:17 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index e1b25d6..fb69424 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 18:56:18 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_TrivialReporter.js.html b/doc/symbols/src/lib_TrivialReporter.js.html index a3f7524..4f23e2c 100644 --- a/doc/symbols/src/lib_TrivialReporter.js.html +++ b/doc/symbols/src/lib_TrivialReporter.js.html @@ -26,115 +26,119 @@ 19 for (var attr in attrs) { 20 if (attr == 'className') { 21 el.setAttribute('class', attrs[attr]); - 22 } else { - 23 el[attr] = attrs[attr]; - 24 } - 25 } - 26 - 27 return el; - 28 }; - 29 - 30 jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { - 31 var suites = runner.suites(); - 32 - 33 this.runnerDiv = this.createDom('div', { className: 'runner running' }, - 34 this.createDom('a', { className: 'runSpec', href: '?' }, "run all"), - 35 this.runnerMessageSpan = this.createDom('span', {}, "Running...")); - 36 this.document.body.appendChild(this.runnerDiv); - 37 - 38 for (var i = 0; i < suites.length; i++) { - 39 var suite = suites[i]; - 40 var suiteDiv = this.createDom('div', { className: 'suite' }, - 41 this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - 42 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); - 43 this.suiteDivs[suite.getFullName()] = suiteDiv; - 44 var parentDiv = this.document.body; - 45 if (suite.parentSuite) { - 46 parentDiv = this.suiteDivs[suite.parentSuite.getFullName()]; - 47 } - 48 parentDiv.appendChild(suiteDiv); - 49 } - 50 - 51 this.startedAt = new Date(); - 52 }; - 53 - 54 jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - 55 var results = runner.results(); - 56 var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - 57 this.runnerDiv.setAttribute("class", className); - 58 var specs = runner.specs(); - 59 var specCount = 0; - 60 for (var i = 0; i < specs.length; i++) { - 61 if (this.specFilter(specs[i])) { - 62 specCount++; - 63 } - 64 } - 65 var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - 66 message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - 67 this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); - 68 }; - 69 - 70 jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - 71 var results = suite.results(); - 72 var status = results.passed() ? 'passed' : 'failed'; - 73 if (results.totalCount == 0) { // todo: change this to check results.skipped - 74 status = 'skipped'; - 75 } - 76 this.suiteDivs[suite.getFullName()].className += " " + status; - 77 }; - 78 - 79 jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - 80 var results = spec.results(); - 81 var status = results.passed() ? 'passed' : 'failed'; - 82 if (results.skipped) { - 83 status = 'skipped'; - 84 } - 85 var specDiv = this.createDom('div', { className: 'spec ' + status }, - 86 this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - 87 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName())); - 88 - 89 - 90 var resultItems = results.getItems(); - 91 for (var i = 0; i < resultItems.length; i++) { - 92 var result = resultItems[i]; - 93 if (result.passed && !result.passed()) { - 94 var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'}); - 95 resultMessageDiv.innerHTML = result.message; // todo: lame; mend - 96 specDiv.appendChild(resultMessageDiv); - 97 specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); - 98 } - 99 } -100 -101 this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); -102 }; -103 -104 jasmine.TrivialReporter.prototype.log = function() { -105 console.log.apply(console, arguments); + 22 //twice for ie + 23 el.setAttribute('className', attrs[attr]); + 24 } else { + 25 el[attr] = attrs[attr]; + 26 } + 27 } + 28 + 29 return el; + 30 }; + 31 + 32 jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { + 33 var suites = runner.suites(); + 34 + 35 this.runnerDiv = this.createDom('div', { className: 'runner running' }, + 36 this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), + 37 this.runnerMessageSpan = this.createDom('span', {}, "Running...")); + 38 this.document.body.appendChild(this.runnerDiv); + 39 + 40 for (var i = 0; i < suites.length; i++) { + 41 var suite = suites[i]; + 42 var suiteDiv = this.createDom('div', { className: 'suite' }, + 43 this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), + 44 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); + 45 this.suiteDivs[suite.getFullName()] = suiteDiv; + 46 var parentDiv = this.document.body; + 47 if (suite.parentSuite) { + 48 parentDiv = this.suiteDivs[suite.parentSuite.getFullName()]; + 49 } + 50 parentDiv.appendChild(suiteDiv); + 51 } + 52 + 53 this.startedAt = new Date(); + 54 }; + 55 + 56 jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { + 57 var results = runner.results(); + 58 var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; + 59 this.runnerDiv.setAttribute("class", className); + 60 //do it twice for IE + 61 this.runnerDiv.setAttribute("className", className); + 62 var specs = runner.specs(); + 63 var specCount = 0; + 64 for (var i = 0; i < specs.length; i++) { + 65 if (this.specFilter(specs[i])) { + 66 specCount++; + 67 } + 68 } + 69 var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); + 70 message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; + 71 this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); + 72 }; + 73 + 74 jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { + 75 var results = suite.results(); + 76 var status = results.passed() ? 'passed' : 'failed'; + 77 if (results.totalCount == 0) { // todo: change this to check results.skipped + 78 status = 'skipped'; + 79 } + 80 this.suiteDivs[suite.getFullName()].className += " " + status; + 81 }; + 82 + 83 jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { + 84 var results = spec.results(); + 85 var status = results.passed() ? 'passed' : 'failed'; + 86 if (results.skipped) { + 87 status = 'skipped'; + 88 } + 89 var specDiv = this.createDom('div', { className: 'spec ' + status }, + 90 this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), + 91 this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName())); + 92 + 93 + 94 var resultItems = results.getItems(); + 95 for (var i = 0; i < resultItems.length; i++) { + 96 var result = resultItems[i]; + 97 if (result.passed && !result.passed()) { + 98 var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'}); + 99 resultMessageDiv.innerHTML = result.message; // todo: lame; mend +100 specDiv.appendChild(resultMessageDiv); +101 specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); +102 } +103 } +104 +105 this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); 106 }; 107 -108 jasmine.TrivialReporter.prototype.getLocation = function() { -109 return this.document.location; +108 jasmine.TrivialReporter.prototype.log = function() { +109 console.log.apply(console, arguments); 110 }; 111 -112 jasmine.TrivialReporter.prototype.specFilter = function(spec) { -113 var paramMap = {}; -114 var params = this.getLocation().search.substring(1).split('&'); -115 for (var i = 0; i < params.length; i++) { -116 var p = params[i].split('='); -117 paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); -118 } -119 -120 if (!paramMap["spec"]) return true; -121 return spec.getFullName().indexOf(paramMap["spec"]) == 0; -122 }; +112 jasmine.TrivialReporter.prototype.getLocation = function() { +113 return this.document.location; +114 }; +115 +116 jasmine.TrivialReporter.prototype.specFilter = function(spec) { +117 var paramMap = {}; +118 var params = this.getLocation().search.substring(1).split('&'); +119 for (var i = 0; i < params.length; i++) { +120 var p = params[i].split('='); +121 paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); +122 } 123 -124 //protect against console.log incidents -125 if (!("console" in window) || !("firebug" in console)) { -126 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; -127 window.console = {}; -128 for (var i = 0, len = names.length; i < len; ++i) { -129 window.console[names[i]] = function() { -130 }; -131 } -132 } -133 \ No newline at end of file +124 if (!paramMap["spec"]) return true; +125 return spec.getFullName().indexOf(paramMap["spec"]) == 0; +126 }; +127 +128 //protect against console.log incidents +129 if (!("console" in window) || !("firebug" in console)) { +130 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; +131 window.console = {}; +132 for (var i = 0, len = names.length; i < len; ++i) { +133 window.console[names[i]] = function() { +134 }; +135 } +136 } +137 \ No newline at end of file diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index cedc063..113d176 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -537,7 +537,7 @@ 530 "major": 0, 531 "minor": 9, 532 "build": 0, -533 "revision": 1255657888 +533 "revision": 1255658178 534 }; 535 /** 536 * @namespace diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 81e3e79..dbc1795 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -19,6 +19,8 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA for (var attr in attrs) { if (attr == 'className') { el.setAttribute('class', attrs[attr]); + //twice for ie + el.setAttribute('className', attrs[attr]); } else { el[attr] = attrs[attr]; } @@ -31,14 +33,14 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { var suites = runner.suites(); this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'runSpec', href: '?' }, "run all"), + this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), this.runnerMessageSpan = this.createDom('span', {}, "Running...")); this.document.body.appendChild(this.runnerDiv); for (var i = 0; i < suites.length; i++) { var suite = suites[i]; var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), + this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); this.suiteDivs[suite.getFullName()] = suiteDiv; var parentDiv = this.document.body; @@ -55,6 +57,8 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { var results = runner.results(); var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; this.runnerDiv.setAttribute("class", className); + //do it twice for IE + this.runnerDiv.setAttribute("className", className); var specs = runner.specs(); var specCount = 0; for (var i = 0; i < specs.length; i++) { @@ -83,7 +87,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { status = 'skipped'; } var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), + this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName())); diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.9.0.js index e957838..e895a25 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.9.0.js @@ -530,7 +530,7 @@ jasmine.version_= { "major": 0, "minor": 9, "build": 0, - "revision": 1255658178 + "revision": 1255662021 }; /** * @namespace diff --git a/lib/jasmine.css b/lib/jasmine.css index 71a8c96..7d8b3e2 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -1,39 +1,27 @@ body { - font: 14px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; + font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; } -h1 { - padding-top: 20px; - font-weight: bold; - font: 24px; /* "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; */ -} -p { - margin-top: 5px; - padding-left: 20px; -} - -.fail { - background: url( ../images/fail-16.png ) no-repeat; - padding-left: 20px; - color: red; -} - -.failInSummary { - color: red; -} - -.runner { - border: 1px outset gray; - margin: 5px; - padding-left: 1em; - padding-right: 1em; +body .run_spec { + float:right; } .runner.running { background-color: yellow; } + + +.runner { + border: 1px solid gray; + margin: 5px; + padding-left: 1em; + padding-right: 1em; +} + + + .suite { border: 1px outset gray; margin: 5px; @@ -54,11 +42,11 @@ p { } .passed { - background-color: lightgreen; + background-color: #cfc; } .failed { - background-color: pink; + background-color: #fdd; } .skipped { @@ -66,9 +54,9 @@ p { background-color: #eee; } -.resultMessage { - white-space: pre; -} +/*.resultMessage {*/ + /*white-space: pre;*/ +/*}*/ .stackTrace { white-space: pre; @@ -81,10 +69,6 @@ p { background: #eef; } -.runSpec { - margin-left: 5px; - float: right; -} #jasmine_content { position:fixed; From 2597c235d99b2ed0e921fb008a23c67e5bea8d42 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 23:27:19 -0700 Subject: [PATCH 17/18] Updated docs to reflect 0.9.0 release --- README.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 709f8f6..3b45bbb 100644 --- a/README.markdown +++ b/README.markdown @@ -31,9 +31,11 @@ open `examples/test/html/example_suite.html` in your favorite browser. Releases ---------- -0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master) +0.10.0 [[download]](http://github.com/pivotal/jasmine/zipball/master) `git clone git://github.com/pivotal/jasmine.git` +0.9.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.9.0) + 0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0) ### Which Release Should I Use? From 3109e7a4bb171a07e389e7005e1cbf4b91092567 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Fri, 16 Oct 2009 20:10:20 -0700 Subject: [PATCH 18/18] Jasmine version to 0.10.0 --- doc/files.html | 2 +- doc/index.html | 2 +- doc/symbols/_global_.html | 2 +- doc/symbols/jasmine.Block.html | 2 +- doc/symbols/jasmine.Env.html | 2 +- doc/symbols/jasmine.JsApiReporter.html | 2 +- doc/symbols/jasmine.MultiReporter.html | 2 +- doc/symbols/jasmine.NestedResults.html | 2 +- doc/symbols/jasmine.Reporter.html | 2 +- doc/symbols/jasmine.Runner.html | 2 +- doc/symbols/jasmine.Spec.html | 2 +- doc/symbols/jasmine.Spy.html | 2 +- doc/symbols/jasmine.Suite.html | 2 +- doc/symbols/jasmine.html | 2 +- doc/symbols/jasmine.util.html | 2 +- doc/symbols/src/lib_jasmine-0.9.0.js.html | 2 +- examples/html/example_suite.html | 2 +- lib/{jasmine-0.9.0.js => jasmine-0.10.0.js} | 4 ++-- src/version.json | 2 +- 19 files changed, 20 insertions(+), 20 deletions(-) rename lib/{jasmine-0.9.0.js => jasmine-0.10.0.js} (99%) diff --git a/doc/files.html b/doc/files.html index e414f84..b14af2e 100644 --- a/doc/files.html +++ b/doc/files.html @@ -258,7 +258,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index 5f76f46..0c74c1e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -300,7 +300,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
\ No newline at end of file diff --git a/doc/symbols/_global_.html b/doc/symbols/_global_.html index 804f25e..e1c277a 100644 --- a/doc/symbols/_global_.html +++ b/doc/symbols/_global_.html @@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Block.html b/doc/symbols/jasmine.Block.html index 7bbb432..dde4c8a 100644 --- a/doc/symbols/jasmine.Block.html +++ b/doc/symbols/jasmine.Block.html @@ -339,7 +339,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Env.html b/doc/symbols/jasmine.Env.html index 2a4c65a..f5e54d7 100644 --- a/doc/symbols/jasmine.Env.html +++ b/doc/symbols/jasmine.Env.html @@ -507,7 +507,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.JsApiReporter.html b/doc/symbols/jasmine.JsApiReporter.html index b377e65..4d96fce 100644 --- a/doc/symbols/jasmine.JsApiReporter.html +++ b/doc/symbols/jasmine.JsApiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.MultiReporter.html b/doc/symbols/jasmine.MultiReporter.html index 3bd08e5..a5a2726 100644 --- a/doc/symbols/jasmine.MultiReporter.html +++ b/doc/symbols/jasmine.MultiReporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.NestedResults.html b/doc/symbols/jasmine.NestedResults.html index 24f5547..9adba9b 100644 --- a/doc/symbols/jasmine.NestedResults.html +++ b/doc/symbols/jasmine.NestedResults.html @@ -700,7 +700,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Reporter.html b/doc/symbols/jasmine.Reporter.html index ea615fb..35a744c 100644 --- a/doc/symbols/jasmine.Reporter.html +++ b/doc/symbols/jasmine.Reporter.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Runner.html b/doc/symbols/jasmine.Runner.html index 35adb7a..bb095e5 100644 --- a/doc/symbols/jasmine.Runner.html +++ b/doc/symbols/jasmine.Runner.html @@ -418,7 +418,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spec.html b/doc/symbols/jasmine.Spec.html index 1d0f210..a5c3947 100644 --- a/doc/symbols/jasmine.Spec.html +++ b/doc/symbols/jasmine.Spec.html @@ -396,7 +396,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Spy.html b/doc/symbols/jasmine.Spy.html index 4cc7f9b..df1d8c7 100644 --- a/doc/symbols/jasmine.Spy.html +++ b/doc/symbols/jasmine.Spy.html @@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.Suite.html b/doc/symbols/jasmine.Suite.html index dcb7998..59eecfd 100644 --- a/doc/symbols/jasmine.Suite.html +++ b/doc/symbols/jasmine.Suite.html @@ -436,7 +436,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.html b/doc/symbols/jasmine.html index 262de77..bb4e197 100644 --- a/doc/symbols/jasmine.html +++ b/doc/symbols/jasmine.html @@ -728,7 +728,7 @@ Jasmine environment.
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:16 GMT-0700 (PDT)
diff --git a/doc/symbols/jasmine.util.html b/doc/symbols/jasmine.util.html index fb69424..b6ac0ce 100644 --- a/doc/symbols/jasmine.util.html +++ b/doc/symbols/jasmine.util.html @@ -316,7 +316,7 @@ ul.inheritsList
- Documentation generated by JsDoc Toolkit 2.1.0 on Thu Oct 15 2009 20:00:21 GMT-0700 (PDT) + Documentation generated by JsDoc Toolkit 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
diff --git a/doc/symbols/src/lib_jasmine-0.9.0.js.html b/doc/symbols/src/lib_jasmine-0.9.0.js.html index 113d176..32323ad 100644 --- a/doc/symbols/src/lib_jasmine-0.9.0.js.html +++ b/doc/symbols/src/lib_jasmine-0.9.0.js.html @@ -537,7 +537,7 @@ 530
"major": 0, 531 "minor": 9, 532 "build": 0, -533 "revision": 1255658178 +533 "revision": 1255662021 534 }; 535 /** 536 * @namespace diff --git a/examples/html/example_suite.html b/examples/html/example_suite.html index 5e3c681..7d98f06 100644 --- a/examples/html/example_suite.html +++ b/examples/html/example_suite.html @@ -4,7 +4,7 @@ Jasmine Test Runner - + diff --git a/lib/jasmine-0.9.0.js b/lib/jasmine-0.10.0.js similarity index 99% rename from lib/jasmine-0.9.0.js rename to lib/jasmine-0.10.0.js index e895a25..409b19f 100644 --- a/lib/jasmine-0.9.0.js +++ b/lib/jasmine-0.10.0.js @@ -528,9 +528,9 @@ jasmine.include = function(url, opt_global) { jasmine.version_= { "major": 0, - "minor": 9, + "minor": 10, "build": 0, - "revision": 1255662021 + "revision": 1255748957 }; /** * @namespace diff --git a/src/version.json b/src/version.json index 693bcc9..13dde9c 100644 --- a/src/version.json +++ b/src/version.json @@ -1,5 +1,5 @@ { "major": 0, - "minor": 9, + "minor": 10, "build": 0 } \ No newline at end of file