diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-04-23 17:07:31 -0400 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-25 12:41:12 -0400 |
commit | 51650338838e61d4d785968ddb5317233b76f55a (patch) | |
tree | 68b46dc6449ace81a0190d9dc1bd3549bb10707f /test | |
parent | 83e9ce95d753bac0a860271ca85aef474295c1c4 (diff) | |
download | jquery-51650338838e61d4d785968ddb5317233b76f55a.tar.gz jquery-51650338838e61d4d785968ddb5317233b76f55a.zip |
Add tests data- and aria- attributes and the autofocus boolean attribute and some style updates in jQuery.attr
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/attributes.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 0889bf339..cfe676a63 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -177,7 +177,7 @@ test("attr(Hash)", function() { }); test("attr(String, Object)", function() { - expect(30); + expect(35); var div = jQuery("div").attr("foo", "bar"), fail = false; @@ -189,7 +189,7 @@ test("attr(String, Object)", function() { } } - equals( fail, false, "Set Attribute, the #"+fail+" element didn't get the attribute 'foo'" ); + equals( fail, false, "Set Attribute, the #" + fail + " element didn't get the attribute 'foo'" ); // Fails on IE since recent changes to .attr() // ok( jQuery("#foo").attr({"width": null}), "Try to set an attribute to nothing" ); @@ -213,7 +213,15 @@ test("attr(String, Object)", function() { var $p = jQuery("#firstp").attr("nonexisting", "foo"); equals( $p.attr("nonexisting"), "foo", "attr(name, value) works correctly for non existing attributes (bug #7500)."); $p.removeAttr("nonexisting"); - + + var $text = jQuery("#text1").attr("autofocus", true); + equals( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name"); + equals( $text.attr("autofocus", false).attr("autofocus"), undefined, "Setting autofocus attribute to false removes it"); + equals( $text.attr("data-something", true).data("something"), true, "Setting data attributes are not affected by boolean settings"); + equals( $text.attr("data-another", false).data("another"), false, "Setting data attributes are not affected by boolean settings" ); + equals( $text.attr("aria-disabled", false).attr("aria-disabled"), "false", "Setting aria attributes are not affected by boolean settings"); + $text.removeData("something").removeData("another").removeAttr("aria-disabled"); + var attributeNode = document.createAttribute("irrelevant"), commentNode = document.createComment("some comment"), textNode = document.createTextNode("some text"); |