# HG changeset patch # User Atul Varma # Date 1239376438 25200 # Node ID 25d079125b953e3a5d24c3911ec3d73edd94da29 # Parent fdbad39a91701ab5a7f5d72e2dc9b351e51d208f Changed display of test output to be more colorful and not require firebug. diff -r fdbad39a9170 -r 25d079125b95 index.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.css Fri Apr 10 08:13:58 2009 -0700 @@ -0,0 +1,18 @@ +.test { +} + +.in-progress { + background-color: yellow; +} + +.successful { + background-color: lawnGreen; +} + +.failed { + background-color: red; +} + +.pending { + background-color: lightGrey; +} diff -r fdbad39a9170 -r 25d079125b95 index.html --- a/index.html Fri Apr 10 07:47:39 2009 -0700 +++ b/index.html Fri Apr 10 08:13:58 2009 -0700 @@ -3,14 +3,44 @@ + + Browser Couch Tests

Browser Couch Tests

+
+
diff -r fdbad39a9170 -r 25d079125b95 tests.js --- a/tests.js Fri Apr 10 07:47:39 2009 -0700 +++ b/tests.js Fri Apr 10 08:13:58 2009 -0700 @@ -1,13 +1,7 @@ var Tests = { - run: function(container, console, setTimeout) { + run: function(listener, container, setTimeout) { if (!container) container = this; - if (!console) { - if (!window.console) - throw new Error("window.console unavailable"); - else - console = window.console; - } if (!setTimeout) setTimeout = window.setTimeout; @@ -20,6 +14,7 @@ func: container[name], isAsync: name.indexOf("_async") != -1, console: console, + id: tests.length, assertEqual: function assertEqual(a, b) { if (a != b) throw new Error(a + " != " + b); @@ -28,22 +23,22 @@ tests.push(test); } + listener.onReady(tests); var nextTest = 0; function runNextTest() { if (nextTest < tests.length) { var test = tests[nextTest]; - console.log("Running " + test.name + "..."); + listener.onRun(test); test.done = function() { - console.log("OK"); + listener.onFinish(this); setTimeout(runNextTest, 0); }; test.func(test); if (!test.isAsync) test.done(); nextTest++; - } else - console.log("All tests passed."); + } } runNextTest();