diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2015-10-18 17:21:41 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-10-21 16:23:44 -0400 |
commit | 47ccf3daadc4b312f850502300129952e70f9d9d (patch) | |
tree | 29e0b1066f17a695fa7091752a43e42450072b77 /test/unit/attributes.js | |
parent | 15ac848868e993dfe5ccd7751a94f5c8edc288bc (diff) | |
download | jquery-47ccf3daadc4b312f850502300129952e70f9d9d.tar.gz jquery-47ccf3daadc4b312f850502300129952e70f9d9d.zip |
Attributes: do not set properties to false when removing booleans
Fixes gh-1759
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r-- | test/unit/attributes.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 564fb12e0..c1e159b8f 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -564,7 +564,7 @@ QUnit.test( "attr('tabindex', value)", function( assert ) { } ); QUnit.test( "removeAttr(String)", function( assert ) { - assert.expect( 12 ); + assert.expect( 13 ); var $first; assert.equal( jQuery( "#mark" ).removeAttr( "class" ).attr( "class" ), undefined, "remove class" ); @@ -575,7 +575,9 @@ QUnit.test( "removeAttr(String)", function( assert ) { assert.equal( jQuery( "#fx-test-group" ).attr( "height", "3px" ).removeAttr( "height" ).get( 0 ).style.height, "1px", "Removing height attribute has no effect on height set with style attribute" ); jQuery( "#check1" ).removeAttr( "checked" ).prop( "checked", true ).removeAttr( "checked" ); - assert.equal( document.getElementById( "check1" ).checked, false, "removeAttr sets boolean properties to false" ); + assert.equal( document.getElementById( "check1" ).checked, true, "removeAttr should not set checked to false, since the checked attribute does NOT mirror the checked property" ); + jQuery( "#option1b" ).attr( "selected", "selected" ).removeAttr( "selected" ).attr( "selected", "selected" ); + assert.notEqual( document.getElementById( "select1" ).selectedIndex, 1, "Once the selected attribute is dirty, subsequent settings should not select the option (gh-1759)" ); jQuery( "#text1" ).prop( "readOnly", true ).removeAttr( "readonly" ); assert.equal( document.getElementById( "text1" ).readOnly, false, "removeAttr sets boolean properties to false" ); |