🌐 AI搜索 & 代理 主页
Skip to content

Commit 5e028c7

Browse files
committed
Tests: Remove remaining obsolete jQuery.cache references
PR gh-4586 removed some of those but not all. Closes gh-4715 Ref gh-4586 (cherry picked from commit d96111e)
1 parent 8ad78cd commit 5e028c7

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

��test/data/testrunner.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
( function() {
22

3-
// Store the old counts so that we only assert on tests that have actually leaked,
3+
"use strict";
4+
5+
// Store the old count so that we only assert on tests that have actually leaked,
46
// instead of asserting every time a test has leaked sometime in the past
5-
var oldCacheLength = 0,
6-
oldActive = 0,
7+
var oldActive = 0,
78

8-
expectedDataKeys = {},
99
splice = [].splice,
1010
ajaxSettings = jQuery.ajaxSettings;
1111

@@ -24,11 +24,6 @@ QUnit.config.requireExpects = true;
2424
* teardown function on all modules' lifecycle object.
2525
*/
2626
window.moduleTeardown = function( assert ) {
27-
var i, expectedKeys, actualKeys,
28-
cacheLength = 0;
29-
30-
// Reset data register
31-
expectedDataKeys = {};
3227

3328
// Check for (and clean up, if possible) incomplete animations/requests/etc.
3429
if ( jQuery.timers && jQuery.timers.length !== 0 ) {
@@ -45,19 +40,6 @@ window.moduleTeardown = function( assert ) {
4540
}
4641

4742
Globals.cleanup();
48-
49-
for ( i in jQuery.cache ) {
50-
++cacheLength;
51-
}
52-
53-
// Because QUnit doesn't have a mechanism for retrieving
54-
// the number of expected assertions for a test,
55-
// if we unconditionally assert any of these,
56-
// the test will fail with too many assertions :|
57-
if ( cacheLength !== oldCacheLength ) {
58-
assert.equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
59-
oldCacheLength = cacheLength;
60-
}
6143
};
6244

6345
QUnit.done( function() {

test/unit/wrap.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function manipulationFunctionReturningObj( value ) {
2121

2222
function testWrap( val, assert ) {
2323

24-
assert.expect( 19 );
24+
assert.expect( 18 );
2525

2626
var defaultText, result, j, i, cacheLength;
2727

@@ -68,12 +68,6 @@ function testWrap( val, assert ) {
6868
"Check node,textnode,comment wraps doesn't hurt text"
6969
);
7070

71-
// Try wrapping a disconnected node
72-
cacheLength = 0;
73-
for ( i in jQuery.cache ) {
74-
cacheLength++;
75-
}
76-
7771
j = jQuery( "<label></label>" ).wrap( val( "<li></li>" ) );
7872
assert.equal(
7973
j[ 0 ] .nodeName.toUpperCase(), "LABEL", "Element is a label"
@@ -82,13 +76,6 @@ function testWrap( val, assert ) {
8276
j[ 0 ].parentNode.nodeName.toUpperCase(), "LI", "Element has been wrapped"
8377
);
8478

85-
for ( i in jQuery.cache ) {
86-
cacheLength--;
87-
}
88-
assert.equal(
89-
cacheLength, 0, "No memory leak in jQuery.cache (bug #7165)"
90-
);
91-
9279
// Wrap an element containing a text node
9380
j = jQuery( "<span></span>" ).wrap( "<div>test</div>" );
9481
assert.equal(

0 commit comments

Comments
 (0)