Merge "SpecialMovepage: Convert form to use OOUI controls"
[lhc/web/wiklou.git] / tests / qunit / data / testrunner.js
index 41754b4..01f9625 100644 (file)
@@ -8,12 +8,12 @@
        /**
         * Add bogus to url to prevent IE crazy caching
         *
-        * @param value {String} a relative path (eg. 'data/foo.js'
+        * @param {String} value a relative path (eg. 'data/foo.js'
         * or 'data/test.php?foo=bar').
         * @return {String} Such as 'data/foo.js?131031765087663960'
         */
        QUnit.fixurl = function ( value ) {
-               return value + (/\?/.test( value ) ? '&' : '?')
+               return value + ( /\?/.test( value ) ? '&' : '?' )
                        + String( new Date().getTime() )
                        + String( parseInt( Math.random() * 100000, 10 ) );
        };
@@ -66,7 +66,7 @@
        sinon.config = {
                injectIntoThis: true,
                injectInto: null,
-               properties: ['spy', 'stub', 'mock', 'sandbox'],
+               properties: [ 'spy', 'stub', 'mock', 'sandbox' ],
                // Don't fake timers by default
                useFakeTimers: false,
                useFakeServer: false
        /**
         * Reset mw.config and others to a fresh copy of the live config for each test(),
         * and restore it back to the live one afterwards.
-        * @param localEnv {Object} [optional]
+        *
+        * @param {Object} [localEnv]
         * @example (see test suite at the bottom of this file)
         * </code>
         */
                                },
 
                                teardown: function () {
-                                       var timers, active;
+                                       var timers, pending, $activeLen;
 
                                        localEnv.teardown.call( this );
 
                                                $.each( $.timers, function ( i, timer ) {
                                                        var node = timer.elem;
                                                        mw.log.warn( 'Unfinished animation #' + i + ' in ' + timer.queue + ' queue on ' +
-                                                               mw.html.element( node.nodeName.toLowerCase(), $(node).getAttrs() )
+                                                               mw.html.element( node.nodeName.toLowerCase(), $( node ).getAttrs() )
                                                        );
                                                } );
                                                // Force animations to stop to give the next test a clean start
                                        }
 
                                        // Test should use fake XHR, wait for requests, or call abort()
-                                       if ( $.active !== undefined && $.active !== 0 ) {
-                                               active = $.grep( ajaxRequests, function ( ajax ) {
+                                       $activeLen = $.active;
+                                       if ( $activeLen !== undefined && $activeLen !== 0 ) {
+                                               pending = $.grep( ajaxRequests, function ( ajax ) {
                                                        return ajax.xhr.state() === 'pending';
                                                } );
-                                               if ( active.length !== $.active ) {
+                                               if ( pending.length !== $activeLen ) {
                                                        mw.log.warn( 'Pending requests does not match jQuery.active count' );
                                                }
                                                // Force requests to stop to give the next test a clean start
-                                               $.each( active, function ( i, ajax ) {
-                                                       mw.log.warn( 'Unfinished AJAX request #' + i, ajax.options );
+                                               $.each( pending, function ( i, ajax ) {
+                                                       mw.log.warn( 'Pending AJAX request #' + i, ajax.options );
                                                        ajax.xhr.abort();
                                                } );
                                                ajaxRequests = [];
 
-                                               throw new Error( 'Unfinished AJAX requests: ' + active.length );
+                                               throw new Error( 'Pending AJAX requests: ' + pending.length + ' (active: ' + $activeLen + ')' );
                                        }
                                }
                        };
                        children = $node.contents();
                        processedChildren = [];
                        for ( i = 0, len = children.length; i < len; i++ ) {
-                               el = children[i];
+                               el = children[ i ];
                                if ( el.nodeType === Node.ELEMENT_NODE || el.nodeType === Node.TEXT_NODE ) {
                                        processedChildren.push( getDomStructure( el ) );
                                }
         * @param {string} html HTML markup for one or more nodes.
         */
        function getHtmlStructure( html ) {
-               var el = $( '<div>' ).append( html )[0];
+               var el = $( '<div>' ).append( html )[ 0 ];
                return getDomStructure( el );
        }
 
                        missing = [];
 
                for ( i = 0, len = modules.length; i < len; i++ ) {
-                       state = mw.loader.getState( modules[i] );
+                       state = mw.loader.getState( modules[ i ] );
                        if ( state === 'error' ) {
-                               error.push( modules[i] );
+                               error.push( modules[ i ] );
                        } else if ( state === 'missing' ) {
-                               missing.push( modules[i] );
+                               missing.push( modules[ i ] );
                        }
                }