aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/attributes.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-03-16 11:52:05 -0400
committerTimmy Willison <timmywillisn@gmail.com>2015-03-16 11:52:05 -0400
commit5dc4616ca0fdbf2a80890bd9b236e796b84db8c1 (patch)
tree0f49e28bf583579b7368d8334b801eb8324b5e23 /test/unit/attributes.js
parentaaeed53e9f1e299975cb6f697c8038ec3a83fa4d (diff)
downloadjquery-5dc4616ca0fdbf2a80890bd9b236e796b84db8c1.tar.gz
jquery-5dc4616ca0fdbf2a80890bd9b236e796b84db8c1.zip
Attributes: fix failing test for new return value
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r--test/unit/attributes.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index c4bd17c17..1163ff4e1 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -377,8 +377,17 @@ test( "attr(String, Object)", function() {
jQuery.each( [ window, document, obj, "#firstp" ], function( i, elem ) {
var oldVal = elem.nonexisting,
$elem = jQuery( elem );
- strictEqual( $elem.attr("nonexisting"), null, "attr works correctly for non existing attributes (bug #7500)." );
- equal( $elem.attr( "nonexisting", "foo" ).attr("nonexisting"), "foo", "attr falls back to prop on unsupported arguments" );
+ // Falls back to prop, which returns undefined
+ strictEqual(
+ $elem.attr( "nonexisting" ),
+ typeof $elem[0].getAttribute === "undefined" ? undefined : null,
+ "attr works correctly for non existing attributes (bug #7500)."
+ );
+ equal(
+ $elem.attr( "nonexisting", "foo" ).attr( "nonexisting" ),
+ "foo",
+ "attr falls back to prop on unsupported arguments"
+ );
elem.nonexisting = oldVal;
});