Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Update validTest() : Simplify logic, clarify vars and add comments
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 9 May 2012 21:10:40 +0000 (23:10 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 16 May 2012 11:13:17 +0000 (13:13 +0200)
qunit/qunit.js

index 2b60fbd..c681aba 100644 (file)
@@ -1000,29 +1000,26 @@ function done() {
 }
 
 function validTest( name ) {
-       var not,
-               filter = config.filter,
-               run = false;
+       var include,
+               filter = config.filter;
 
+       // By default, run all tests
        if ( !filter ) {
                return true;
        }
 
-       not = filter.charAt( 0 ) === "!";
-
-       if ( not ) {
+       include = filter.charAt( 0 ) !== "!";
+       if ( !include ) {
                filter = filter.slice( 1 );
        }
 
+       // If the filter matches, we need to honour include
        if ( name.indexOf( filter ) !== -1 ) {
-               return !not;
-       }
-
-       if ( not ) {
-               run = true;
+               return include;
        }
 
-       return run;
+       // Otherwise, do the opposite
+       return !include;
 }
 
 // so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)

Hosting is provided AltSPAHow to use Git
Please direct any questions on jabber alex.wolf@jabber.ru

Valid HTML 4.0 Transitional Valid CSS!

Designer Alexander Wolf