diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-12-09 00:26:24 -0500 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2012-12-15 23:16:48 -0500 |
commit | a763ae72775f69509d0a8a6b50702bcf2c7e6fbf (patch) | |
tree | b88d062c5199bec72e02e3145c0120aea542fb1d /test/unit/selector.js | |
parent | 55a8ba52268ba0ef33cb750f5795add38f29d067 (diff) | |
download | jquery-a763ae72775f69509d0a8a6b50702bcf2c7e6fbf.tar.gz jquery-a763ae72775f69509d0a8a6b50702bcf2c7e6fbf.zip |
Fix #11115: Normalize boolean attributes/properties. Close gh-1066.
Diffstat (limited to 'test/unit/selector.js')
-rw-r--r-- | test/unit/selector.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js index 799603012..21113207c 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -31,7 +31,7 @@ test("class - jQuery only", function() { }); test("attributes - jQuery only", function() { - expect( 4 ); + expect( 6 ); t( "Find elements with a tabindex attribute", "[tabindex]", ["listWithTabIndex", "foodWithNegativeTabIndex", "linkWithTabIndex", "linkWithNegativeTabIndex", "linkWithNoHrefWithTabIndex", "linkWithNoHrefWithNegativeTabIndex"] ); @@ -53,6 +53,14 @@ test("attributes - jQuery only", function() { ok( jQuery("<input type='text' value='12600'/>").prop( "value", "option" ).is(":input[value='12600']"), ":input[value=foo] selects text input by attribute" ); + + // #11115 + ok( jQuery("<input type='checkbox' checked='checked'/>").prop( "checked", false ).is("[checked]"), + "[checked] selects by attribute (positive)" + ); + ok( !jQuery("<input type='checkbox'/>").prop( "checked", true ).is("[checked]"), + "[checked] selects by attribute (negative)" + ); }); if ( jQuery.css ) { @@ -83,7 +91,7 @@ test("disconnected nodes", function() { var $opt = jQuery("<option></option>").attr("value", "whipit").appendTo("#qunit-fixture").detach(); equal( $opt.val(), "whipit", "option value" ); equal( $opt.is(":selected"), false, "unselected option" ); - $opt.attr("selected", true); + $opt.prop("selected", true); equal( $opt.is(":selected"), true, "selected option" ); var $div = jQuery("<div/>"); |