|
2 | 2 | QUnit.module( "attributes" );
|
3 | 3 |
|
4 | 4 | QUnit.test( ".removeAttr( boolean attribute )", function( assert ) {
|
5 |
| - assert.expect( 8 ); |
| 5 | + assert.expect( 14 ); |
6 | 6 |
|
7 | 7 | expectNoWarning( assert, "non-boolean attr", function() {
|
8 | 8 | var $div = jQuery( "<div />" )
|
@@ -40,6 +40,26 @@ QUnit.test( ".removeAttr( boolean attribute )", function( assert ) {
|
40 | 40 | .removeAttr( "size" );
|
41 | 41 | } );
|
42 | 42 |
|
| 43 | + expectNoWarning( assert, "boolean attr when prop false", function() { |
| 44 | + var $inp = jQuery( "<input type=checkbox/>" ) |
| 45 | + .attr( "checked", "checked" ) |
| 46 | + .prop( "checked", false ) |
| 47 | + .removeAttr( "checked" ); |
| 48 | + |
| 49 | + assert.equal( $inp.attr( "checked" ), null, "boolean attribute was removed" ); |
| 50 | + assert.equal( $inp.prop( "checked" ), false, "property was not changed" ); |
| 51 | + } ); |
| 52 | + |
| 53 | + expectWarning( assert, "boolean attr when only some props false", 1, function() { |
| 54 | + var $inp = jQuery( "<input type=checkbox/><input type=checkbox/><input type=checkbox/>" ) |
| 55 | + .attr( "checked", "checked" ) |
| 56 | + .prop( "checked", false ) |
| 57 | + .eq( 1 ).prop( "checked", true ).end() |
| 58 | + .removeAttr( "checked" ); |
| 59 | + |
| 60 | + assert.equal( $inp.attr( "checked" ), null, "boolean attribute was removed" ); |
| 61 | + assert.equal( $inp.eq( 1 ).prop( "checked" ), false, "property was changed" ); |
| 62 | + } ); |
43 | 63 | } );
|
44 | 64 |
|
45 | 65 | QUnit.test( ".toggleClass( boolean )", function( assert ) {
|
|
0 commit comments