Allow individual specs to be rerun; show skipped tests in gray.
This commit is contained in:
parent
22226f3423
commit
e476f2375a
@ -12,6 +12,18 @@
|
||||
<script type="text/javascript">
|
||||
var jasmineEnv = jasmine.getEnv();
|
||||
var jsApiReporter = new jasmine.JsApiReporter();
|
||||
jasmineEnv.specFilter = function(spec) {
|
||||
var paramMap = {};
|
||||
var params = document.location.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;
|
||||
};
|
||||
|
||||
jasmineEnv.addReporter(jsApiReporter);
|
||||
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
||||
window.onload = function() {
|
||||
|
@ -26,19 +26,22 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||
console.log(runner);
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||
console.log(suite);
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||
var specDiv = this.createDom('div', {
|
||||
className: spec.getResults().passed() ? 'spec passed' : 'spec failed'
|
||||
}, spec.getFullName());
|
||||
var results = spec.getResults();
|
||||
var status = results.passed() ? 'passed' : 'failed';
|
||||
if (results.skipped) {
|
||||
status = 'skipped';
|
||||
}
|
||||
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
||||
this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
||||
spec.getFullName());
|
||||
|
||||
var resultItems = spec.getResults().getItems();
|
||||
var resultItems = results.getItems();
|
||||
for (var i = 0; i < resultItems.length; i++) {
|
||||
var result = resultItems[i];
|
||||
if (!result.passed) {
|
||||
|
@ -20,12 +20,13 @@ p {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.fail_in_summary {
|
||||
.failInSummary {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.spec {
|
||||
margin: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.passed {
|
||||
@ -36,6 +37,11 @@ p {
|
||||
background-color: pink;
|
||||
}
|
||||
|
||||
.skipped {
|
||||
color: #777;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.resultMessage {
|
||||
white-space: pre;
|
||||
}
|
||||
@ -49,3 +55,8 @@ p {
|
||||
border-left: 1px solid red;
|
||||
padding-left: 5em;
|
||||
}
|
||||
|
||||
.runSpec {
|
||||
margin-left: 5px;
|
||||
float: right;
|
||||
}
|
2
spec/bootstrap.js
vendored
2
spec/bootstrap.js
vendored
@ -42,7 +42,7 @@ Reporter.prototype.test = function (result, message) {
|
||||
};
|
||||
|
||||
Reporter.prototype.summary = function () {
|
||||
var el = createElement('p', {'class': ((this.fails > 0) ? 'fail_in_summary' : '') });
|
||||
var el = createElement('p', {'class': ((this.fails > 0) ? 'failInSummary' : '') });
|
||||
el.innerHTML = this.total + ' expectations, ' + this.passes + ' passing, ' + this.fails + ' failed in ' + (new Date().getTime() - this.start.getTime()) + "ms.";
|
||||
|
||||
var summaryElement = document.getElementById('results_summary');
|
||||
|
Loading…
Reference in New Issue
Block a user