Added visual pass/fail indicator (JUnit/Eclipse style)

This commit is contained in:
Jörn Zaefferer 2006-11-15 10:08:08 +00:00
parent d6ab3c71ac
commit db621dd8dd
2 changed files with 10 additions and 5 deletions

View file

@ -43,10 +43,11 @@ function runTest(tests) {
synchronize(function() {
var runTime = new Date() - startTime;
var result = document.createElement("div");
result.innerHTML = '<p class="result">Tests completed in ' +
runTime + ' milliseconds.<br/>' +
stats.bad + ' tests of ' + stats.all + ' failed.</p>';
result.innerHTML = ['<p class="result">Tests completed in ',
runTime, ' milliseconds.<br/>',
stats.bad, ' tests of ', stats.all, ' failed.</p>'].join('');
document.getElementsByTagName("body")[0].appendChild(result);
$("<div id='banner'>").addClass(stats.bad ? "fail" : "pass").insertAfter("h1");
});
}

View file

@ -1,8 +1,12 @@
body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
body { margin: 0; padding: 0; font-size: small; }
h1 { padding: 15px; margin: 0; font-size: large; background-color: #06b; color: white; border-bottom: 1px solid #ccc }
h1 { padding: 15px; margin: 0; font-size: large; background-color: #06b; color: white; }
h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
.pass { color: green; }
.fail { color: red; }
p.result { margin-left: 1em; }
#banner { height: 2em; }
#banner.pass { background-color: green }
#banner.fail { background-color: red; }