X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Fdata%2Ftestrunner.js;h=c1114a5969b8190fc6f3d86c7346e60f51c5e9ea;hb=ba391eccf9ab50056e2126f712741537d27fe1c9;hp=eabcd8e6f77adfb8edf94ea88662e9abfecc11a0;hpb=f861c88b1bb8f9c0bf37ec86cb12a3f7206680c3;p=jquery.git diff --git a/test/data/testrunner.js b/test/data/testrunner.js index eabcd8e..c1114a5 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -13,6 +13,9 @@ var _config = { asyncTimeout: 2 // seconds for async timeout }; +_config.filters = location.search.length > 1 && //restrict modules/tests by get parameters + $.map( location.search.slice(1).split('&'), decodeURIComponent ); + var isLocal = !!(window.location.protocol == 'file:'); $(function() { @@ -54,6 +57,26 @@ function start() { }, 13); } +function validTest( name ) { + var filters = _config.filters; + if( !filters ) + return true; + + var i = filters.length, + run = false; + while( i-- ){ + var filter = filters[i], + not = filter.charAt(0) == '!'; + if( not ) + filter = filter.slice(1); + if( name.indexOf(filter) != -1 ) + return !not; + if( not ) + run = true; + } + return run; +} + function runTest() { _config.blocking = false; var time = new Date(); @@ -73,8 +96,7 @@ function test(name, callback, nowait) { if(_config.currentModule) name = _config.currentModule + " module: " + name; - var filter = location.search.slice(1); - if ( filter && !new RegExp(filter).test(encodeURIComponent(name)) ) + if ( !validTest(name) ) return; synchronize(function() { @@ -224,7 +246,7 @@ function serialArray( a ) { r.push( str ); } - return "[ " + r.join(", ") + " ]" + return "[ " + r.join(", ") + " ]"; } /**