aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2020-09-01 10:42:03 +0200
committerGitHub <noreply@github.com>2020-09-01 10:42:03 +0200
commita4421101fd6d9d7b0550210f8e8690641733dd9a (patch)
tree469cb196fb4952677d415118e77533dd72185dc6 /test/unit
parent68b4ec59c8f290d680e9db4bc980655660817dd1 (diff)
downloadjquery-a4421101fd6d9d7b0550210f8e8690641733dd9a.tar.gz
jquery-a4421101fd6d9d7b0550210f8e8690641733dd9a.zip
Attributes: Drop the `toggleClass(boolean|undefined)` signature
The behavior of this signature is not intuitive, especially if classes are manipulated via other ways between `toggleClass` calls. Fixes gh-3388 Closes gh-4766
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/attributes.js21
1 files changed, 1 insertions, 20 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 4b014bacc..d83375172 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -1415,7 +1415,7 @@ QUnit.test( "removeClass(undefined) is a no-op", function( assert ) {
} );
var testToggleClass = function( valueObj, assert ) {
- assert.expect( 19 );
+ assert.expect( 11 );
var e = jQuery( "#firstp" );
assert.ok( !e.is( ".test" ), "Assert class not present" );
@@ -1443,25 +1443,6 @@ var testToggleClass = function( valueObj, assert ) {
assert.ok( ( e.is( ".testA.testC" ) && !e.is( ".testB" ) ), "Assert 1 class added, 1 class removed, and 1 class kept" );
e.toggleClass( valueObj( "testA testC" ) );
assert.ok( ( !e.is( ".testA" ) && !e.is( ".testB" ) && !e.is( ".testC" ) ), "Assert no class present" );
-
- // toggleClass storage
- e.toggleClass( true );
- assert.ok( e[ 0 ].className === "", "Assert class is empty (data was empty)" );
- e.addClass( "testD testE" );
- assert.ok( e.is( ".testD.testE" ), "Assert class present" );
- e.toggleClass();
- assert.ok( !e.is( ".testD.testE" ), "Assert class not present" );
- assert.ok( jQuery._data( e[ 0 ], "__className__" ) === "testD testE", "Assert data was stored" );
- e.toggleClass();
- assert.ok( e.is( ".testD.testE" ), "Assert class present (restored from data)" );
- e.toggleClass( false );
- assert.ok( !e.is( ".testD.testE" ), "Assert class not present" );
- e.toggleClass( true );
- assert.ok( e.is( ".testD.testE" ), "Assert class present (restored from data)" );
- e.toggleClass();
- e.toggleClass( false );
- e.toggleClass();
- assert.ok( e.is( ".testD.testE" ), "Assert class present (restored from data)" );
};
QUnit.test( "toggleClass(String|boolean|undefined[, boolean])", function( assert ) {