X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fjquery%2Fjquery.qunit.completenessTest.js;h=4353dd7d1d227724d07167698541ffa4f02f3837;hb=2231d4e859628fc4d2fb63a7a752ead5b91ffef2;hp=785b27387c07ebd78fcf853699aa189a1b2540d0;hpb=35f61c7c4b38388dc498f898193f1dda0461e0b3;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/jquery/jquery.qunit.completenessTest.js b/resources/src/jquery/jquery.qunit.completenessTest.js index 785b27387c..4353dd7d1d 100644 --- a/resources/src/jquery/jquery.qunit.completenessTest.js +++ b/resources/src/jquery/jquery.qunit.completenessTest.js @@ -17,9 +17,9 @@ var util, hasOwn = Object.prototype.hasOwnProperty, - log = ( window.console && window.console.log ) - ? function () { return window.console.log.apply( window.console, arguments ); } - : function () {}; + log = ( window.console && window.console.log ) ? + function () { return window.console.log.apply( window.console, arguments ); } : + function () {}; // Simplified version of a few jQuery methods, except that they don't // call other jQuery methods. Required to be able to run the CompletenessTest @@ -94,11 +94,11 @@ } ); QUnit.done( function () { + var toolbar, testResults, cntTotal, cntCalled, cntMissing; + that.populateMissingTests(); log( 'CompletenessTest/populateMissingTests', that ); - var toolbar, testResults, cntTotal, cntCalled, cntMissing; - cntTotal = util.keys( that.injectionTracker ).length; cntCalled = util.keys( that.methodCallTracker ).length; cntMissing = util.keys( that.missingTests ).length; @@ -186,9 +186,9 @@ * Depending on the action it either injects our listener into the methods, or * reads from our tracker and records which methods have not been called by the test suite. * - * @param {String|Null} currName Name of the given object member (Initially this is null). - * @param {mixed} currVar The variable to check (initially an object, + * @param {Mixed} currObj The variable to check (initially an object, * further down it could be anything). + * @param {string|null} currName Name of the given object member (Initially this is null). * @param {Object} masterVariable Throughout our interation, always keep track of the master/root. * Initially this is the same as currVar. * @param {Array} parentPathArray Array of names that indicate our breadcrumb path starting at @@ -211,14 +211,14 @@ // Hard ignores if ( this.ignoreFn( currVal, this, currPathArray ) ) { - return null; + return; } // Handle the lazy limit this.lazyCounter++; if ( this.lazyCounter > this.lazyLimit ) { log( 'CompletenessTest.fn.walkTheObject> Limit reached: ' + this.lazyCounter, currPathArray ); - return null; + return; } // Functions @@ -258,8 +258,8 @@ * was called during the test suite (as far as the tracker knows). * If not it adds it to missingTests. * - * @param {String} fnName - * @return {Boolean} + * @param {string} fnName + * @return {boolean} */ hasTest: function ( fnName ) { if ( !( fnName in this.methodCallTracker ) ) { @@ -275,9 +275,10 @@ * Injects a function (such as a spy that updates methodCallTracker when * it's called) inside another function. * - * @param {Object} masterVariable - * @param {Array} objectPathArray - * @param {Function} injectFn + * @param {Object} obj The object into which `injectFn` will be inserted + * @param {Array} key The key by which `injectFn` will be known in `obj`; if this already + * exists, a wrapper will first call `injectFn` and then the original `obj[key]` function. + * @param {Function} injectFn The function to insert */ injectCheck: function ( obj, key, injectFn ) { var spy, @@ -291,11 +292,7 @@ // Make the spy inherit from the original so that its static methods are also // visible in the spy (e.g. when we inject a check into mw.log, mw.log.warn // must remain accessible). - // XXX: https://github.com/jshint/jshint/issues/2656 - /*jshint ignore:start */ - /*jshint proto:true */ spy.__proto__ = val; - /*jshint ignore:end */ // Objects are by reference, members (unless objects) are not. obj[ key ] = spy;