From 331730f8f5409c9842b88ba5a61f302e98c52a08 Mon Sep 17 00:00:00 2001 From: Brian Jenkins & Aaron Peckham Date: Fri, 31 Jul 2009 17:07:47 -0700 Subject: [PATCH 01/20] Changed run.html to expect the jasmine git to be served at /jasmine --- .tylium/bootstrap.rb | 1 + contrib/ruby/run.html | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .tylium/bootstrap.rb diff --git a/.tylium/bootstrap.rb b/.tylium/bootstrap.rb new file mode 100644 index 0000000..7efa85c --- /dev/null +++ b/.tylium/bootstrap.rb @@ -0,0 +1 @@ +require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '.tylium', 'bootstrap')) diff --git a/contrib/ruby/run.html b/contrib/ruby/run.html index 7ddbe80..c435004 100644 --- a/contrib/ruby/run.html +++ b/contrib/ruby/run.html @@ -3,9 +3,9 @@ Jasmine suite - - - + + + From 457b5a011f6f5f6f7255176f63e7b4c731a91331 Mon Sep 17 00:00:00 2001 From: Christian Williams & Erik Hanson Date: Fri, 7 Aug 2009 14:11:40 -0700 Subject: [PATCH 02/20] Use jasmine CSS, and get rid of HTML in plain text stacktrace --- contrib/ruby/jasmine_spec_builder.rb | 2 +- contrib/ruby/run.html | 2 +- lib/TrivialReporter.js | 2 +- lib/jasmine.css | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/ruby/jasmine_spec_builder.rb b/contrib/ruby/jasmine_spec_builder.rb index 0071a49..591cd10 100644 --- a/contrib/ruby/jasmine_spec_builder.rb +++ b/contrib/ruby/jasmine_spec_builder.rb @@ -121,7 +121,7 @@ module Jasmine out << "\n" unless message["passed"] - stack_trace = message["trace"]["stack"] + stack_trace = message["trace"]["stack"].gsub(/
/, "\n").gsub(/<\/?b>/, " ") STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/") STDERR << "\n" end diff --git a/contrib/ruby/run.html b/contrib/ruby/run.html index c435004..501590d 100644 --- a/contrib/ruby/run.html +++ b/contrib/ruby/run.html @@ -8,7 +8,7 @@ - + <% spec_files.each do |spec_file| %> diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index c236480..396c636 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -59,6 +59,22 @@ jasmine.TrivialReporter.prototype.log = function() { console.log.apply(console, arguments); }; +jasmine.TrivialReporter.prototype.getLocation = function() { + return document.location; +}; + +jasmine.TrivialReporter.prototype.specFilter = function(spec) { + var paramMap = {}; + var params = this.getLocation().search.substring(1).split('&'); + for (var i = 0; i < params.length; i++) { + var p = params[i].split('='); + paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); + } + + if (!paramMap["spec"]) return true; + return spec.getFullName().indexOf(paramMap["spec"]) > -1; +}; + //protect against console.log incidents if (!("console" in window) || !("firebug" in console)) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; diff --git a/spec/runner.html b/spec/runner.html index 41c87bd..3f68374 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -37,31 +37,11 @@ jasmine.include('suites/RunnerTest.js', true); jasmine.include('suites/SpecRunningTest.js', true); jasmine.include('suites/SpyTest.js', true); + jasmine.include('suites/TrivialReporterTest.js', true); - + diff --git a/spec/suites/TrivialReporterTest.js b/spec/suites/TrivialReporterTest.js new file mode 100644 index 0000000..2a1ec7c --- /dev/null +++ b/spec/suites/TrivialReporterTest.js @@ -0,0 +1,19 @@ +describe("TrivialReporter", function() { + function fakeSpec(name) { + return { + getFullName: function() { return name; } + }; + } + + it("should allow for focused spec running", function() { + var trivialReporter = new jasmine.TrivialReporter(); + spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"}); + expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy(); + }); + + it("should not run specs that don't match the filter", function() { + var trivialReporter = new jasmine.TrivialReporter(); + spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"}); + expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy(); + }); +}); \ No newline at end of file From 4b244612c1abb0e34484070440d820edd64df55e Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Mon, 10 Aug 2009 17:50:03 -0700 Subject: [PATCH 09/20] Visually group specs by suite. --- lib/TrivialReporter.js | 28 ++++++++++++++++++++++++---- lib/jasmine.css | 6 ++++++ lib/jasmine.js | 22 ++++++++++++++++++++++ spec/suites/RunnerTest.js | 13 +++++++++++++ spec/suites/TrivialReporterTest.js | 29 ++++++++++++++++++++++------- src/Runner.js | 22 ++++++++++++++++++++++ 6 files changed, 109 insertions(+), 11 deletions(-) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 396c636..5adc7a3 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -1,4 +1,6 @@ -jasmine.TrivialReporter = function() { +jasmine.TrivialReporter = function(doc) { + this.document = doc || document; + this.suiteDivs = {}; }; jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { @@ -25,6 +27,24 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA return el; }; +jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { + var suites = runner.getAllSuites(); + 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"), + suite.description); + console.log(suite); + console.log(suite.getFullName()); + this.suiteDivs[suite.getFullName()] = suiteDiv; + var parentDiv = this.document.body; + if (suite.parentSuite) { + parentDiv = this.suiteDivs[suite.parentSuite.getFullName()]; + } + parentDiv.appendChild(suiteDiv); + } +}; + jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { }; @@ -52,7 +72,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { } } - document.body.appendChild(specDiv); + this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); }; jasmine.TrivialReporter.prototype.log = function() { @@ -60,7 +80,7 @@ jasmine.TrivialReporter.prototype.log = function() { }; jasmine.TrivialReporter.prototype.getLocation = function() { - return document.location; + return this.document.location; }; jasmine.TrivialReporter.prototype.specFilter = function(spec) { @@ -72,7 +92,7 @@ jasmine.TrivialReporter.prototype.specFilter = function(spec) { } if (!paramMap["spec"]) return true; - return spec.getFullName().indexOf(paramMap["spec"]) > -1; + return spec.getFullName().indexOf(paramMap["spec"]) == 0; }; //protect against console.log incidents diff --git a/lib/jasmine.css b/lib/jasmine.css index 980fa5b..19fcfa4 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -24,6 +24,12 @@ p { color: red; } +.suite { + border: 1px outset gray; + margin: 2px; + padding-left: 1em; +} + .spec { margin: 5px; clear: both; diff --git a/lib/jasmine.js b/lib/jasmine.js index 0954c59..785bee4 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -1724,6 +1724,28 @@ jasmine.Runner.prototype.finishCallback = function() { this.env.reporter.reportRunnerResults(this); }; +jasmine.Runner.prototype.getAllSuites = function() { + var suitesToReturn = []; + + function addSuite(suite) { + suitesToReturn.push(suite); + + for (var j = 0; j < suite.specs.length; j++) { + var spec = suite.specs[j]; + if (spec instanceof jasmine.Suite) { + addSuite(spec); + } + } + } + + for (var i = 0; i < this.suites.length; i++) { + var suite = this.suites[i]; + addSuite(suite); + } + + return suitesToReturn; +}; + jasmine.Runner.prototype.getResults = function() { var results = new jasmine.NestedResults(); for (var i = 0; i < this.suites.length; i++) { diff --git a/spec/suites/RunnerTest.js b/spec/suites/RunnerTest.js index c0009b3..7aaca2f 100644 --- a/spec/suites/RunnerTest.js +++ b/spec/suites/RunnerTest.js @@ -123,4 +123,17 @@ describe('RunnerTest', function() { expect(fakeReporter.reportRunnerStarting).wasCalledWith(env.currentRunner); }); + it("should return a flat array of all suites, including nested suites", function() { + var suite1, suite2; + suite1 = env.describe("spec 1", function() { + suite2 = env.describe("nested spec", function() {}); + }); + + console.log("runner:", env.currentRunner); + document.runner = env.currentRunner; + + var suites = env.currentRunner.getAllSuites(); + expect(suites).toEqual([suite1, suite2]); + }); + }); \ No newline at end of file diff --git a/spec/suites/TrivialReporterTest.js b/spec/suites/TrivialReporterTest.js index 2a1ec7c..4b1118f 100644 --- a/spec/suites/TrivialReporterTest.js +++ b/spec/suites/TrivialReporterTest.js @@ -1,19 +1,34 @@ describe("TrivialReporter", function() { + var trivialReporter; + var body; + + beforeEach(function() { + body = document.createElement("body"); + }); + function fakeSpec(name) { return { getFullName: function() { return name; } }; } - it("should allow for focused spec running", function() { - var trivialReporter = new jasmine.TrivialReporter(); - spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"}); + it("should run only specs beginning with spec parameter", function() { + trivialReporter = new jasmine.TrivialReporter({ location: {search: "?spec=run%20this"} }); expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy(); + expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy(); + expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy(); }); - it("should not run specs that don't match the filter", function() { - var trivialReporter = new jasmine.TrivialReporter(); - spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"}); - expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy(); + it("should display empty divs for every suite when the runner is starting", function() { + trivialReporter = new jasmine.TrivialReporter({ body: body }); + trivialReporter.reportRunnerStarting({ + getAllSuites: function() { + return [ new jasmine.Suite(null, "suite 1", null, null) ]; + } + }); + + var divs = body.getElementsByTagName("div"); + expect(divs.length).toEqual(1); + expect(divs[0].innerHTML).toContain("suite 1"); }); }); \ No newline at end of file diff --git a/src/Runner.js b/src/Runner.js index 725cbe1..ce7dff0 100644 --- a/src/Runner.js +++ b/src/Runner.js @@ -22,6 +22,28 @@ jasmine.Runner.prototype.finishCallback = function() { this.env.reporter.reportRunnerResults(this); }; +jasmine.Runner.prototype.getAllSuites = function() { + var suitesToReturn = []; + + function addSuite(suite) { + suitesToReturn.push(suite); + + for (var j = 0; j < suite.specs.length; j++) { + var spec = suite.specs[j]; + if (spec instanceof jasmine.Suite) { + addSuite(spec); + } + } + } + + for (var i = 0; i < this.suites.length; i++) { + var suite = this.suites[i]; + addSuite(suite); + } + + return suitesToReturn; +}; + jasmine.Runner.prototype.getResults = function() { var results = new jasmine.NestedResults(); for (var i = 0; i < this.suites.length; i++) { From 2ef71580ad567ad241d87cdf102772568d15f44f Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Mon, 10 Aug 2009 17:54:20 -0700 Subject: [PATCH 10/20] Color suites to reflect spec pass/fail status. --- lib/TrivialReporter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 5adc7a3..f51fbd6 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -49,6 +49,12 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { + var results = suite.getResults(); + var status = results.passed() ? 'passed' : 'failed'; + if (results.totalCount == 0) { // todo: change this to check results.skipped + status = 'skipped'; + } + this.suiteDivs[suite.getFullName()].className += " " + status; }; jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { From 8f12dbf3b48ff0707b9ea55c98c0f9fdc1b88645 Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Mon, 10 Aug 2009 17:59:24 -0700 Subject: [PATCH 11/20] Suites are a little lighter colored. --- lib/jasmine.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/jasmine.css b/lib/jasmine.css index 19fcfa4..3c8f6af 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -30,6 +30,14 @@ p { padding-left: 1em; } +.suite.passed { + background-color: #cfc; +} + +.suite.failed { + background-color: #fdd; +} + .spec { margin: 5px; clear: both; From 624a6dd85cfd521edb54d2314309d095c07f9f44 Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Mon, 10 Aug 2009 18:07:03 -0700 Subject: [PATCH 12/20] More application of prettiness. --- contrib/ruby/run.html | 2 ++ lib/jasmine.css | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/ruby/run.html b/contrib/ruby/run.html index db74351..0f3035d 100644 --- a/contrib/ruby/run.html +++ b/contrib/ruby/run.html @@ -13,6 +13,8 @@ var jsApiReporter; (function() { var jasmineEnv = jasmine.getEnv(); + jasmineEnv.updateInterval = 1000; + jsApiReporter = new jasmine.JsApiReporter(); var trivialReporter = new jasmine.TrivialReporter(); diff --git a/lib/jasmine.css b/lib/jasmine.css index 3c8f6af..e7706d9 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -26,7 +26,7 @@ p { .suite { border: 1px outset gray; - margin: 2px; + margin: 5px; padding-left: 1em; } @@ -66,8 +66,9 @@ p { margin-left: 10px; height: 5em; overflow: auto; - border-left: 1px solid red; - padding-left: 5em; + border: 1px inset red; + padding: 1em; + background: #eef; } .runSpec { From 93c7b092b3f4f9c2cdcdfbd646991a25acdb10ea Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Tue, 11 Aug 2009 12:05:56 -0700 Subject: [PATCH 13/20] Un-pad body. --- lib/jasmine.css | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/jasmine.css b/lib/jasmine.css index e7706d9..f24ff43 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -1,6 +1,5 @@ body { font: 14px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; - padding-left: 40px; } h1 { From 4410c7cd946e6222fb900842bd8295b1ab15eab5 Mon Sep 17 00:00:00 2001 From: Erik Hanson Date: Wed, 12 Aug 2009 10:15:15 -0700 Subject: [PATCH 14/20] added failure count to top of trivial reporter --- lib/TrivialReporter.js | 12 ++++++++++++ lib/jasmine.css | 10 ++++++++++ spec/suites/TrivialReporterTest.js | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index f51fbd6..aaa69e8 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -29,6 +29,10 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { var suites = runner.getAllSuites(); + + this.runnerDiv = this.createDom('div', { className: 'runner running' }, "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' }, @@ -46,6 +50,14 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { }; jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { + this.log(">>>>>>>>>>>>>>>>>"); + this.log(runner.getResults()); + + var results = runner.getResults(); + var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; + this.runnerDiv.setAttribute("class", className); + var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); + this.runnerDiv.replaceChild(this.document.createTextNode(message), this.runnerDiv.firstChild); }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { diff --git a/lib/jasmine.css b/lib/jasmine.css index f24ff43..6370d7a 100644 --- a/lib/jasmine.css +++ b/lib/jasmine.css @@ -23,6 +23,16 @@ p { color: red; } +.runner { + border: 1px outset gray; + margin: 5px; + padding-left: 1em; +} + +.runner.running { + background-color: yellow; +} + .suite { border: 1px outset gray; margin: 5px; diff --git a/spec/suites/TrivialReporterTest.js b/spec/suites/TrivialReporterTest.js index 4b1118f..d1db547 100644 --- a/spec/suites/TrivialReporterTest.js +++ b/spec/suites/TrivialReporterTest.js @@ -28,7 +28,7 @@ describe("TrivialReporter", function() { }); var divs = body.getElementsByTagName("div"); - expect(divs.length).toEqual(1); - expect(divs[0].innerHTML).toContain("suite 1"); + expect(divs.length).toEqual(2); + expect(divs[1].innerHTML).toContain("suite 1"); }); }); \ No newline at end of file From 3e68a2c2bc92850f99cd22efc906efb376ea49df Mon Sep 17 00:00:00 2001 From: Erik Hanson & Evan Cooney Date: Wed, 12 Aug 2009 16:12:57 -0700 Subject: [PATCH 15/20] remove a leftover call to "console.log" --- lib/TrivialReporter.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index aaa69e8..3092dd6 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -50,9 +50,6 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { }; jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - this.log(">>>>>>>>>>>>>>>>>"); - this.log(runner.getResults()); - var results = runner.getResults(); var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; this.runnerDiv.setAttribute("class", className); From 8378dd95feeacc44799b872af3f651ef623a5a13 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Wed, 12 Aug 2009 22:19:51 -0700 Subject: [PATCH 16/20] Remove cruft --- .tylium/bootstrap.rb | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .tylium/bootstrap.rb diff --git a/.tylium/bootstrap.rb b/.tylium/bootstrap.rb deleted file mode 100644 index 7efa85c..0000000 --- a/.tylium/bootstrap.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '.tylium', 'bootstrap')) From ca077342f3e563b1070f61c4a15a8be5f3c55cec Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Fri, 14 Aug 2009 15:39:28 -0700 Subject: [PATCH 17/20] Added toBeLessThan and toBeGreaterThan matchers. --- lib/jasmine.js | 10 ++++++++++ spec/suites/MatchersTest.js | 12 ++++++++++++ src/Matchers.js | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/lib/jasmine.js b/lib/jasmine.js index 785bee4..a1be3be 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -1148,6 +1148,16 @@ jasmine.Matchers.prototype.toNotContain = function(item) { 'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.'); }; +jasmine.Matchers.prototype.toBeLessThan = function(expected) { + return this.report(this.actual < expected, + 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +} + +jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { + return this.report(this.actual > expected, + 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +} + /** * Matcher that checks that the expected exception was thrown by the actual. * diff --git a/spec/suites/MatchersTest.js b/spec/suites/MatchersTest.js index 5a3d18e..5199ae0 100644 --- a/spec/suites/MatchersTest.js +++ b/spec/suites/MatchersTest.js @@ -167,6 +167,18 @@ describe("jasmine.Matchers", function() { }); }); + it("toBeLessThan should pass if actual is less than expected", function() { + expect(match(37).toBeLessThan(42)).toEqual(true); + expect(match(37).toBeLessThan(-42)).toEqual(false); + expect(match(37).toBeLessThan(37)).toEqual(false); + }); + + it("toBeGreaterThan should pass if actual is greater than expected", function() { + expect(match(37).toBeGreaterThan(42)).toEqual(false); + expect(match(37).toBeGreaterThan(-42)).toEqual(true); + expect(match(37).toBeGreaterThan(37)).toEqual(false); + }); + it("toThrow", function() { var expected = new jasmine.Matchers(env, function() { throw new Error("Fake Error"); diff --git a/src/Matchers.js b/src/Matchers.js index cb078e8..f69b858 100644 --- a/src/Matchers.js +++ b/src/Matchers.js @@ -216,6 +216,16 @@ jasmine.Matchers.prototype.toNotContain = function(item) { 'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.'); }; +jasmine.Matchers.prototype.toBeLessThan = function(expected) { + return this.report(this.actual < expected, + 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +} + +jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { + return this.report(this.actual > expected, + 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); +} + /** * Matcher that checks that the expected exception was thrown by the actual. * From 8870f907e8da788c575e555a3295eaec3d520ba3 Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Fri, 14 Aug 2009 15:43:36 -0700 Subject: [PATCH 18/20] Fixed formatting. --- src/Matchers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Matchers.js b/src/Matchers.js index f69b858..6319433 100644 --- a/src/Matchers.js +++ b/src/Matchers.js @@ -219,12 +219,12 @@ jasmine.Matchers.prototype.toNotContain = function(item) { jasmine.Matchers.prototype.toBeLessThan = function(expected) { return this.report(this.actual < expected, 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -} +}; jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { return this.report(this.actual > expected, 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -} +}; /** * Matcher that checks that the expected exception was thrown by the actual. From 027b28ecb0f436ed3a94ad70d40d7ac64589fefe Mon Sep 17 00:00:00 2001 From: Aaron Peckham & Christian Williams Date: Fri, 14 Aug 2009 15:44:45 -0700 Subject: [PATCH 19/20] Fix formatting. --- lib/jasmine.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jasmine.js b/lib/jasmine.js index a1be3be..05a858c 100644 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -1151,12 +1151,12 @@ jasmine.Matchers.prototype.toNotContain = function(item) { jasmine.Matchers.prototype.toBeLessThan = function(expected) { return this.report(this.actual < expected, 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -} +}; jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { return this.report(this.actual > expected, 'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.'); -} +}; /** * Matcher that checks that the expected exception was thrown by the actual. From e9126fdd9b8837f3d3c15e47d92dfea37932b157 Mon Sep 17 00:00:00 2001 From: xian Date: Fri, 14 Aug 2009 18:04:52 -0700 Subject: [PATCH 20/20] Fix some problems with merge. --- lib/TrivialReporter.js | 4 ++-- spec/runner.html | 4 ++++ spec/suites/TrivialReporterTest.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 3092dd6..98da1e3 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -59,7 +59,7 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { var results = suite.getResults(); - var status = results.passed() ? 'passed' : 'failed'; + var status = results.passed ? 'passed' : 'failed'; if (results.totalCount == 0) { // todo: change this to check results.skipped status = 'skipped'; } @@ -68,7 +68,7 @@ jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { var results = spec.getResults(); - var status = results.passed() ? 'passed' : 'failed'; + var status = results.passed ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } diff --git a/spec/runner.html b/spec/runner.html index af39888..919565e 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -20,6 +20,9 @@ + + + diff --git a/spec/suites/TrivialReporterTest.js b/spec/suites/TrivialReporterTest.js index d1db547..0ee96c1 100644 --- a/spec/suites/TrivialReporterTest.js +++ b/spec/suites/TrivialReporterTest.js @@ -23,7 +23,7 @@ describe("TrivialReporter", function() { trivialReporter = new jasmine.TrivialReporter({ body: body }); trivialReporter.reportRunnerStarting({ getAllSuites: function() { - return [ new jasmine.Suite(null, "suite 1", null, null) ]; + return [ new jasmine.Suite({}, "suite 1", null, null) ]; } });