diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2020-05-18 18:43:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 18:43:01 +0200 |
commit | d96111e18b42ae1bc7def72a8a0d156ea39e4d0e (patch) | |
tree | d75f5b32b8d7e6854b1a0763ac251b8aa8ce54dc /test | |
parent | 11611967adf2bd9ff4304132f917629ec1134049 (diff) | |
download | jquery-d96111e18b42ae1bc7def72a8a0d156ea39e4d0e.tar.gz jquery-d96111e18b42ae1bc7def72a8a0d156ea39e4d0e.zip |
Tests: Remove remaining obsolete jQuery.cache references
PR gh-4586 removed some of those but not all.
Closes gh-4715
Ref gh-4586
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testrunner.js | 24 | ||||
-rw-r--r-- | test/unit/wrap.js | 15 |
2 files changed, 3 insertions, 36 deletions
diff --git a/test/data/testrunner.js b/test/data/testrunner.js index fd9bc6a49..283c37d8c 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -2,12 +2,10 @@ "use strict"; -// Store the old counts so that we only assert on tests that have actually leaked, +// Store the old count so that we only assert on tests that have actually leaked, // instead of asserting every time a test has leaked sometime in the past -var oldCacheLength = 0, - oldActive = 0, +var oldActive = 0, - expectedDataKeys = {}, splice = [].splice, ajaxSettings = jQuery.ajaxSettings; @@ -26,11 +24,6 @@ QUnit.config.requireExpects = true; * teardown function on all modules' lifecycle object. */ window.moduleTeardown = function( assert ) { - var i, expectedKeys, actualKeys, - cacheLength = 0; - - // Reset data register - expectedDataKeys = {}; // Check for (and clean up, if possible) incomplete animations/requests/etc. if ( jQuery.timers && jQuery.timers.length !== 0 ) { @@ -47,19 +40,6 @@ window.moduleTeardown = function( assert ) { } Globals.cleanup(); - - for ( i in jQuery.cache ) { - ++cacheLength; - } - - // Because QUnit doesn't have a mechanism for retrieving - // the number of expected assertions for a test, - // if we unconditionally assert any of these, - // the test will fail with too many assertions :| - if ( cacheLength !== oldCacheLength ) { - assert.equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); - oldCacheLength = cacheLength; - } }; QUnit.done( function() { diff --git a/test/unit/wrap.js b/test/unit/wrap.js index 21335c36f..3c0990eac 100644 --- a/test/unit/wrap.js +++ b/test/unit/wrap.js @@ -21,7 +21,7 @@ function manipulationFunctionReturningObj( value ) { function testWrap( val, assert ) { - assert.expect( 19 ); + assert.expect( 18 ); var defaultText, result, j, i, cacheLength; @@ -68,12 +68,6 @@ function testWrap( val, assert ) { "Check node,textnode,comment wraps doesn't hurt text" ); - // Try wrapping a disconnected node - cacheLength = 0; - for ( i in jQuery.cache ) { - cacheLength++; - } - j = jQuery( "<label></label>" ).wrap( val( "<li></li>" ) ); assert.equal( j[ 0 ] .nodeName.toUpperCase(), "LABEL", "Element is a label" @@ -82,13 +76,6 @@ function testWrap( val, assert ) { j[ 0 ].parentNode.nodeName.toUpperCase(), "LI", "Element has been wrapped" ); - for ( i in jQuery.cache ) { - cacheLength--; - } - assert.equal( - cacheLength, 0, "No memory leak in jQuery.cache (bug #7165)" - ); - // Wrap an element containing a text node j = jQuery( "<span></span>" ).wrap( "<div>test</div>" ); assert.equal( |