Commit db621dd8 authored by Jörn Zaefferer's avatar Jörn Zaefferer

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

parent d6ab3c71
...@@ -43,10 +43,11 @@ function runTest(tests) { ...@@ -43,10 +43,11 @@ function runTest(tests) {
synchronize(function() { synchronize(function() {
var runTime = new Date() - startTime; var runTime = new Date() - startTime;
var result = document.createElement("div"); var result = document.createElement("div");
result.innerHTML = '<p class="result">Tests completed in ' + result.innerHTML = ['<p class="result">Tests completed in ',
runTime + ' milliseconds.<br/>' + runTime, ' milliseconds.<br/>',
stats.bad + ' tests of ' + stats.all + ' failed.</p>'; stats.bad, ' tests of ', stats.all, ' failed.</p>'].join('');
document.getElementsByTagName("body")[0].appendChild(result); document.getElementsByTagName("body")[0].appendChild(result);
$("<div id='banner'>").addClass(stats.bad ? "fail" : "pass").insertAfter("h1");
}); });
} }
......
body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 } body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
body { margin: 0; padding: 0; font-size: small; } 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 } h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
.pass { color: green; } .pass { color: green; }
.fail { color: red; } .fail { color: red; }
p.result { margin-left: 1em; } p.result { margin-left: 1em; }
\ No newline at end of file
#banner { height: 2em; }
#banner.pass { background-color: green }
#banner.fail { background-color: red; }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment