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">
|
<script type="text/javascript">
|
||||||
var jasmineEnv = jasmine.getEnv();
|
var jasmineEnv = jasmine.getEnv();
|
||||||
var jsApiReporter = new jasmine.JsApiReporter();
|
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(jsApiReporter);
|
||||||
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
|
@ -26,19 +26,22 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||||
console.log(runner);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
console.log(suite);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||||
var specDiv = this.createDom('div', {
|
var results = spec.getResults();
|
||||||
className: spec.getResults().passed() ? 'spec passed' : 'spec failed'
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
}, spec.getFullName());
|
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++) {
|
for (var i = 0; i < resultItems.length; i++) {
|
||||||
var result = resultItems[i];
|
var result = resultItems[i];
|
||||||
if (!result.passed) {
|
if (!result.passed) {
|
||||||
|
@ -20,12 +20,13 @@ p {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fail_in_summary {
|
.failInSummary {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spec {
|
.spec {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.passed {
|
.passed {
|
||||||
@ -36,6 +37,11 @@ p {
|
|||||||
background-color: pink;
|
background-color: pink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.skipped {
|
||||||
|
color: #777;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
.resultMessage {
|
.resultMessage {
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
@ -49,3 +55,8 @@ p {
|
|||||||
border-left: 1px solid red;
|
border-left: 1px solid red;
|
||||||
padding-left: 5em;
|
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 () {
|
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.";
|
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');
|
var summaryElement = document.getElementById('results_summary');
|
||||||
|
Loading…
Reference in New Issue
Block a user