Browse Source

Added test re-running support via click or typing "r"

v1.x
Tj Holowaychuk 14 years ago
parent
commit
24dc3fadb0
  1. 21
      test/public/app.js
  2. 2
      test/public/style.css
  3. 6
      test/views/tests.jade

21
test/public/app.js

@ -1,5 +1,12 @@
window.onload = runTests;
window.onload = function(){
runTests();
get('run').addEventListener('click', runTests, false);
};
document.addEventListener('keypress', function(event){
if (114 == event.charCode) runTests();
}, false);
function get(id) {
return document.getElementById(id);
@ -9,8 +16,15 @@ function create(type) {
return document.createElement(type);
}
function runTests() {
function clearTests() {
var table = get('tests');
table.removeChild(table.children[1]);
}
function runTests() {
clearTests();
var table = get('tests')
, tbody = create('tbody');
for (var name in tests) {
var fn = tests[name]
, canvas = create('canvas')
@ -26,7 +40,8 @@ function runTests() {
tr.appendChild(tds[0]);
tr.appendChild(tds[1]);
tr.appendChild(tds[2]);
table.appendChild(tr);
tbody.appendChild(tr);
table.appendChild(tbody);
runTest(name, canvas, tds[0]);
}
}

2
test/public/style.css

@ -3,7 +3,7 @@ body {
font: 13px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
p {
margin: 5px;
margin: 15px 5px;
}
em {
color: #00C5F7;

6
test/views/tests.jade

@ -5,8 +5,14 @@ p.msg
em exact
| same code utilizing the client canvas api, as well as node-canvas.
p
| Click to
a#run(href='#') re-run
| the test suite or "r".
table#tests
thead
tr
th node-canvas
th target
th source

Loading…
Cancel
Save