aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAriel Flesler <aflesler@gmail.com>2008-04-24 21:32:35 +0000
committerAriel Flesler <aflesler@gmail.com>2008-04-24 21:32:35 +0000
commitba391eccf9ab50056e2126f712741537d27fe1c9 (patch)
treed3f4e088f9d3b65a776c9a5848272da8354598c2 /test
parentf8e5fd6fef68d243d22c593584aaf4ee549ed30c (diff)
downloadjquery-ba391eccf9ab50056e2126f712741537d27fe1c9.tar.gz
jquery-ba391eccf9ab50056e2126f712741537d27fe1c9.zip
- Adding the enhancements to the test runner, to accept multiple(and negative) filters from the GET variables, as specified in the ticket #2738.
Diffstat (limited to 'test')
-rw-r--r--test/data/testrunner.js28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/data/testrunner.js b/test/data/testrunner.js
index 6f426419b..c1114a596 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,9 +57,24 @@ function start() {
}, 13);
}
-function dontrun(name) {
- var filter = location.search.slice(1);
- return filter && !new RegExp(filter).test(encodeURIComponent(name));
+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() {
@@ -78,7 +96,7 @@ function test(name, callback, nowait) {
if(_config.currentModule)
name = _config.currentModule + " module: " + name;
- if (dontrun(name))
+ if ( !validTest(name) )
return;
synchronize(function() {
@@ -228,7 +246,7 @@ function serialArray( a ) {
r.push( str );
}
- return "[ " + r.join(", ") + " ]"
+ return "[ " + r.join(", ") + " ]";
}
/**