diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2015-08-16 09:59:58 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2015-09-07 20:03:50 +0300 |
commit | 10fdad742a2a6aa9f0e00b3e04fc5264797c53c7 (patch) | |
tree | 6b6d7b1375ff88f4bebbfa0703f7b595eb485df9 /test/data/testrunner.js | |
parent | 7aa46e0df8a673e6b00550bbbbed21eed50108b7 (diff) | |
download | jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.tar.gz jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.zip |
Build: Update jscs and lint files
Fixes gh-2056
Diffstat (limited to 'test/data/testrunner.js')
-rw-r--r-- | test/data/testrunner.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/test/data/testrunner.js b/test/data/testrunner.js index 3701870ad..454e8035e 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -1,4 +1,4 @@ -(function() { +( function() { // Store the old counts so that we only assert on tests that have actually leaked, // instead of asserting every time a test has leaked sometime in the past @@ -49,6 +49,7 @@ QUnit.expectJqData = function( env, elems, key ) { // be available as long as the object is not garbage collected by // the js engine, and when it is, the data will be removed with it. if ( !elem.nodeType ) { + // Fixes false positives for dataTests(window), dataTests({}). continue; } @@ -56,6 +57,7 @@ QUnit.expectJqData = function( env, elems, key ) { expando = elem[ jQuery.expando ]; if ( expando === undefined ) { + // In this case the element exists fine, but // jQuery.data (or internal data) was never (in)directly // called. @@ -79,12 +81,12 @@ QUnit.expectJqData = function( env, elems, key ) { } }; -QUnit.config.urlConfig.push({ +QUnit.config.urlConfig.push( { id: "jqdata", label: "Always check jQuery.data", tooltip: "Trigger QUnit.expectJqData detection for all tests " + "instead of just the ones that call it" -}); +} ); /** * Ensures that tests have cleaned up properly after themselves. Should be passed as the @@ -106,6 +108,7 @@ window.moduleTeardown = function() { delete jQuery.cache[ i ]; delete expectedDataKeys[ i ]; } + // In case it was removed from cache before (or never there in the first place) for ( i in expectedDataKeys ) { deepEqual( @@ -129,7 +132,7 @@ window.moduleTeardown = function() { if ( jQuery.active !== undefined && jQuery.active !== oldActive ) { equal( jQuery.active, oldActive, "No AJAX requests are still active" ); if ( ajaxTest.abort ) { - ajaxTest.abort("active requests"); + ajaxTest.abort( "active requests" ); } oldActive = jQuery.active; } @@ -150,15 +153,17 @@ window.moduleTeardown = function() { } }; -QUnit.done(function() { +QUnit.done( function() { + // Remove our own fixtures outside #qunit-fixture supportjQuery( "#qunit ~ *" ).remove(); -}); +} ); -QUnit.testDone(function() { +QUnit.testDone( function() { // Ensure jQuery events and data on the fixture are properly removed jQuery( "#qunit-fixture" ).empty(); + // ...even if the jQuery under test has a broken .empty() supportjQuery( "#qunit-fixture" ).empty(); @@ -172,10 +177,10 @@ QUnit.testDone(function() { // Cleanup globals Globals.cleanup(); -}); +} ); // Register globals for cleanup and the cleanup code itself -window.Globals = (function() { +window.Globals = ( function() { var globals = {}; return { @@ -193,6 +198,6 @@ window.Globals = (function() { globals = {}; } }; -})(); +} )(); -})(); +} )(); |