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