aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-05-07 20:46:38 -0400
committertimmywil <tim.willison@thisismedium.com>2011-05-07 20:46:38 -0400
commit8bb6e95b66413c484006288691a82c44ba50554e (patch)
treeaf9b67ae333b500427a99be7b87d8588d799c2d7 /test/unit/attributes.js
parent3d1c27d52ec667cea5735366a41f65344ab17a5e (diff)
downloadjquery-8bb6e95b66413c484006288691a82c44ba50554e.tar.gz
jquery-8bb6e95b66413c484006288691a82c44ba50554e.zip
Set val before hide/show check and fix easing setting; also update attributes test for autofocus
- The object passed should not change so it can be used in future animates, updated src and tests accordingly.
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r--test/unit/attributes.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 3724f360d..37e93d0a1 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -138,8 +138,8 @@ test("attr(Hash)", function() {
if ( this.getAttribute("foo") != "baz" && this.getAttribute("zoo") != "ping" ) pass = false;
});
ok( pass, "Set Multiple Attributes" );
- equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" );
- equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
+ equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" );
+ equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
});
@@ -211,7 +211,11 @@ test("attr(String, Object)", function() {
$p.removeAttr("nonexisting");
var $text = jQuery("#text1").attr("autofocus", true);
- equals( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name");
+ if ( "autofocus" in $text[0] ) {
+ equals( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name");
+ } else {
+ equals( $text.attr("autofocus"), undefined, "autofocus stays undefined in browsers that do not support it(F<4)");
+ }
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" );