]> source.dussan.org Git - jquery.git/commitdiff
Make sure that undefined is always returned for missing data properties. Follow-up...
authorjeresig <jeresig@gmail.com>
Fri, 24 Sep 2010 20:30:57 +0000 (16:30 -0400)
committerjeresig <jeresig@gmail.com>
Fri, 24 Sep 2010 20:30:57 +0000 (16:30 -0400)
test/unit/data.js

index 25d5196480e5e90498aa8fcae58712174c665cda..77ee0997944a8b986f1d9b21c0a829f904cfd3f9 100644 (file)
@@ -81,11 +81,14 @@ test("jQuery.data", function() {
 });
 
 test(".data()", function() {
-       expect(2);
+       expect(4);
 
        var div = jQuery("#foo");
+       strictEqual( div.data("foo"), undefined, "Make sure that missing result is undefined" );
+
        div.data("test", "success");
        same( div.data(), {test: "success"}, "data() get the entire data object" );
+       strictEqual( div.data("foo"), undefined, "Make sure that missing result is still undefined" );
 
        var nodiv = jQuery("#unfound");
        equals( nodiv.data(), null, "data() on empty set returns null" );