GeezerVison is showing github.com — Tests: Remove obsolete jQuery data tests · jquery/jquery@eb35be5
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/data/testrunner.js -92Lines changed: 0 additions & 92 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,74 +21,6 @@ QUnit.config.testTimeout = 60e3; // 1 minute | 21 | 21 | // Enforce an "expect" argument or expect() call in all test bodies. | 22 | 22 | QUnit.config.requireExpects = true; | 23 | 23 |
| 24 | | -/** | 25 | | - * @param {jQuery|HTMLElement|Object|Array} elems Target (or array of targets) for jQuery.data. | 26 | | - * @param {string} key | 27 | | - */ | 28 | | -QUnit.assert.expectJqData = function( env, elems, key ) { | 29 | | - var i, elem, expando; | 30 | | - | 31 | | - // As of jQuery 2.0, there will be no "cache"-data is | 32 | | - // stored and managed completely below the API surface | 33 | | - if ( jQuery.cache ) { | 34 | | - env.checkJqData = true; | 35 | | - | 36 | | - if ( elems.jquery && elems.toArray ) { | 37 | | - elems = elems.toArray(); | 38 | | - } | 39 | | - if ( !Array.isArray( elems ) ) { | 40 | | - elems = [ elems ]; | 41 | | - } | 42 | | - | 43 | | - for ( i = 0; i < elems.length; i++ ) { | 44 | | - elem = elems[ i ]; | 45 | | - | 46 | | - // jQuery.data only stores data for nodes in jQuery.cache, | 47 | | - // for other data targets the data is stored in the object itself, | 48 | | - // in that case we can't test that target for memory leaks. | 49 | | - // But we don't have to since in that case the data will/must will | 50 | | - // be available as long as the object is not garbage collected by | 51 | | - // the js engine, and when it is, the data will be removed with it. | 52 | | - if ( !elem.nodeType ) { | 53 | | - | 54 | | - // Fixes false positives for dataTests(window), dataTests({}). | 55 | | - continue; | 56 | | - } | 57 | | - | 58 | | - expando = elem[ jQuery.expando ]; | 59 | | - | 60 | | - if ( expando === undefined ) { | 61 | | - | 62 | | - // In this case the element exists fine, but | 63 | | - // jQuery.data (or internal data) was never (in)directly | 64 | | - // called. | 65 | | - // Since this method was called it means some data was | 66 | | - // expected to be found, but since there is nothing, fail early | 67 | | - // (instead of in teardown). | 68 | | - this.notStrictEqual( | 69 | | - expando, | 70 | | - undefined, | 71 | | - "Target for expectJqData must have an expando, " + | 72 | | - "for else there can be no data to expect." | 73 | | - ); | 74 | | - } else { | 75 | | - if ( expectedDataKeys[ expando ] ) { | 76 | | - expectedDataKeys[ expando ].push( key ); | 77 | | - } else { | 78 | | - expectedDataKeys[ expando ] = [ key ]; | 79 | | - } | 80 | | - } | 81 | | - } | 82 | | - } | 83 | | - | 84 | | -}; | 85 | | -QUnit.config.urlConfig.push( { | 86 | | - id: "jqdata", | 87 | | - label: "Always check jQuery.data", | 88 | | - tooltip: "Trigger QUnit.expectJqData detection for all tests " + | 89 | | - "instead of just the ones that call it" | 90 | | -} ); | 91 | | - | 92 | 24 | /** | 93 | 25 | * Ensures that tests have cleaned up properly after themselves. Should be passed as the | 94 | 26 | * teardown function on all modules' lifecycle object. | @@ -97,30 +29,6 @@ window.moduleTeardown = function( assert ) { | 97 | 29 | var i, expectedKeys, actualKeys, | 98 | 30 | cacheLength = 0; | 99 | 31 |
| 100 | | - // Only look for jQuery data problems if this test actually | 101 | | - // provided some information to compare against. | 102 | | - if ( QUnit.urlParams.jqdata || this.checkJqData ) { | 103 | | - for ( i in jQuery.cache ) { | 104 | | - expectedKeys = expectedDataKeys[ i ]; | 105 | | - actualKeys = jQuery.cache[ i ] ? Object.keys( jQuery.cache[ i ] ) : jQuery.cache[ i ]; | 106 | | - if ( !QUnit.equiv( expectedKeys, actualKeys ) ) { | 107 | | - assert.deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" ); | 108 | | - } | 109 | | - delete jQuery.cache[ i ]; | 110 | | - delete expectedDataKeys[ i ]; | 111 | | - } | 112 | | - | 113 | | - // In case it was removed from cache before (or never there in the first place) | 114 | | - for ( i in expectedDataKeys ) { | 115 | | - assert.deepEqual( | 116 | | - expectedDataKeys[ i ], | 117 | | - undefined, | 118 | | - "No unexpected keys were left in jQuery.cache (#" + i + ")" | 119 | | - ); | 120 | | - delete expectedDataKeys[ i ]; | 121 | | - } | 122 | | - } | 123 | | - | 124 | 32 | // Reset data register | 125 | 33 | expectedDataKeys = {}; | 126 | 34 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/unit/attributes.js -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1411,10 +1411,6 @@ var testToggleClass = function( valueObj, assert ) { | 1411 | 1411 | e.toggleClass( false ); | 1412 | 1412 | e.toggleClass(); | 1413 | 1413 | assert.ok( e.is( ".testD.testE" ), "Assert class present (restored from data)" ); | 1414 | | - | 1415 | | - // Cleanup | 1416 | | - e.removeClass( "testD" ); | 1417 | | - assert.expectJqData( this, e[ 0 ], "__className__" ); | 1418 | 1414 | }; | 1419 | 1415 |
| 1420 | 1416 | QUnit.test( "toggleClass(String|boolean|undefined[, boolean])", function( assert ) { | |
Collapse file Copy file name to clipboardExpand all lines: test/unit/data.js -7Lines changed: 0 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -132,11 +132,6 @@ QUnit.test( "jQuery.data(div)", function( assert ) { | 132 | 132 | var div = document.createElement( "div" ); | 133 | 133 |
| 134 | 134 | dataTests( div, assert ); | 135 | | - | 136 | | - // We stored one key in the private data | 137 | | - // assert that nothing else was put in there, and that that | 138 | | - // one stayed there. | 139 | | - assert.expectJqData( this, div, "foo" ); | 140 | 135 | } ); | 141 | 136 |
| 142 | 137 | QUnit.test( "jQuery.data({})", function( assert ) { | @@ -159,8 +154,6 @@ QUnit.test( "jQuery.data(document)", function( assert ) { | 159 | 154 | assert.expect( 25 ); | 160 | 155 |
| 161 | 156 | dataTests( document, assert ); | 162 | | - | 163 | | - assert.expectJqData( this, document, "foo" ); | 164 | 157 | } ); | 165 | 158 |
| 166 | 159 | QUnit.test( "jQuery.data(<embed>)", function( assert ) { | |
Collapse file Copy file name to clipboardExpand all lines: test/unit/effects.js -12Lines changed: 0 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,9 +90,6 @@ QUnit.test( "show()", function( assert ) { | 90 | 90 | assert.ok( pass, "Show with " + name + " does not call animate callback" ); | 91 | 91 | } ); | 92 | 92 |
| 93 | | - // Tolerate data from show()/hide() | 94 | | - assert.expectJqData( this, div, "olddisplay" ); | 95 | | - | 96 | 93 | jQuery( | 97 | 94 | "<div id='show-tests'>" + | 98 | 95 | "<div><p><a href='#'></a></p><code></code><pre></pre><span></span></div>" + | @@ -217,8 +214,6 @@ supportjQuery.each( hideOptions, function( type, setup ) { | 217 | 214 | } ); | 218 | 215 |
| 219 | 216 | clock.tick( 300 ); | 220 | | - | 221 | | - assert.expectJqData( this, $span, "olddisplay" ); | 222 | 217 | } ); | 223 | 218 |
| 224 | 219 | // Support: IE 11+, Edge 12 - 18+ | @@ -251,8 +246,6 @@ supportjQuery.each( hideOptions, function( type, setup ) { | 251 | 246 | } ); | 252 | 247 |
| 253 | 248 | clock.tick( 300 ); | 254 | | - | 255 | | - assert.expectJqData( this, $shadowChild, "olddisplay" ); | 256 | 249 | } ); | 257 | 250 | } ); | 258 | 251 |
| @@ -1161,9 +1154,6 @@ QUnit.test( "interrupt toggle", function( assert ) { | 1161 | 1154 |
| 1162 | 1155 | // Save original property value for comparison | 1163 | 1156 | jQuery.data( this, "startVal", jQuery( this ).css( prop ) ); | 1164 | | - | 1165 | | - // Expect olddisplay data from our .hide() call below | 1166 | | - assert.expectJqData( env, this, "olddisplay" ); | 1167 | 1157 | } ); | 1168 | 1158 |
| 1169 | 1159 | // Interrupt a hiding toggle | @@ -1613,8 +1603,6 @@ QUnit.test( "animate should set display for disconnected nodes", function( asser | 1613 | 1603 | assert.strictEqual( $divInline.show()[ 0 ].style.display, "inline", | 1614 | 1604 | "show() should not change display if it already set" ); | 1615 | 1605 |
| 1616 | | - assert.expectJqData( env, $divNone[ 0 ], "olddisplay" ); | 1617 | | - | 1618 | 1606 | jQuery.each( showMethods, function( name, opt ) { | 1619 | 1607 | jQuery.fn[ name ].apply( jQuery( "<div/>" ), opt.concat( [ function() { | 1620 | 1608 | assert.strictEqual( jQuery( this ).css( "display" ), nullParentDisplay, | |
|