X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=build%2Ftest%2Fdata%2Ftestrunner.js;h=25ffb3f27ba13d14081bb14a1b79877404e28285;hb=2ef4093cf7f52383dd43bd361864edcda27e5c3c;hp=f0e31e7f03dff5b00a63db00c391ca1adc5a2c9b;hpb=74a8e206231162b005d95b667343678f786ae272;p=jquery.git diff --git a/build/test/data/testrunner.js b/build/test/data/testrunner.js index f0e31e7..25ffb3f 100644 --- a/build/test/data/testrunner.js +++ b/build/test/data/testrunner.js @@ -13,12 +13,11 @@ var _config = { asyncTimeout: 2 // seconds for async timeout }; +var isLocal = !!(window.location.protocol == 'file:'); + $(function() { $('#userAgent').html(navigator.userAgent); - if($.browser.safari) - $("h1").append(" - Disabled for Safari"); - else - runTest(); + runTest(); }); function synchronize(callback) { @@ -42,13 +41,17 @@ function stop(allowFailure) { ok( false, "Test timed out" ); start(); }; - _config.timeout = setTimeout(handler, _config.asyncTimeout * 1000); + // Disabled, caused too many random errors + //_config.timeout = setTimeout(handler, _config.asyncTimeout * 1000); } function start() { - if(_config.timeout) - clearTimeout(_config.timeout); - _config.blocking = false; - process(); + // A slight delay, to avoid any current callbacks + setTimeout(function(){ + if(_config.timeout) + clearTimeout(_config.timeout); + _config.blocking = false; + process(); + }, 13); } function runTest() { @@ -67,17 +70,13 @@ function runTest() { } function test(name, callback, nowait) { - // safari seems to have some memory problems, so we need to slow it down - if($.browser.safari && !nowait) { - test("", function() { - stop(); - setTimeout(start, 250); - }, true); - } - if(_config.currentModule) name = _config.currentModule + " module: " + name; + var filter = location.search.slice(1); + if ( filter && encodeURIComponent(name) != filter ) + return; + synchronize(function() { _config.Test = []; try { @@ -123,7 +122,7 @@ function test(name, callback, nowait) { var li = document.createElement("li"); li.className = state; - var b = document.createElement("b"); + var b = document.createElement("strong"); b.innerHTML = name + " (" + bad + ", " + good + ", " + _config.Test.length + ")"; b.onclick = function(){ var n = this.nextSibling; @@ -132,6 +131,13 @@ function test(name, callback, nowait) { else n.style.display = "none"; }; + $(b).dblclick(function(event) { + var target = jQuery(event.target).filter("strong").clone(); + if ( target.length ) { + target.children().remove(); + location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text())); + } + }); li.appendChild( b ); li.appendChild( ol ); @@ -271,7 +277,7 @@ function url(value) { * @param Object actual * @param String message (optional) */ -function equals(expected, actual, message) { +function equals(actual, expected, message) { var result = expected == actual; message = message || (result ? "okay" : "failed"); _config.Test.push( [ result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual ] );