added failure count to top of trivial reporter
This commit is contained in:
parent
93c7b092b3
commit
4410c7cd94
@ -29,6 +29,10 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
|||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||||
var suites = runner.getAllSuites();
|
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++) {
|
for (var i = 0; i < suites.length; i++) {
|
||||||
var suite = suites[i];
|
var suite = suites[i];
|
||||||
var suiteDiv = this.createDom('div', { className: 'suite' },
|
var suiteDiv = this.createDom('div', { className: 'suite' },
|
||||||
@ -46,6 +50,14 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportRunnerResults = 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) {
|
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
|
@ -23,6 +23,16 @@ p {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.runner {
|
||||||
|
border: 1px outset gray;
|
||||||
|
margin: 5px;
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runner.running {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
.suite {
|
.suite {
|
||||||
border: 1px outset gray;
|
border: 1px outset gray;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
|
@ -28,7 +28,7 @@ describe("TrivialReporter", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var divs = body.getElementsByTagName("div");
|
var divs = body.getElementsByTagName("div");
|
||||||
expect(divs.length).toEqual(1);
|
expect(divs.length).toEqual(2);
|
||||||
expect(divs[0].innerHTML).toContain("suite 1");
|
expect(divs[1].innerHTML).toContain("suite 1");
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user