aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/data.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-09-24 16:30:57 -0400
committerjeresig <jeresig@gmail.com>2010-09-24 16:30:57 -0400
commit515efbdc7119aa79de710144effe18413d4cb14a (patch)
tree42a9ff65d34005cecb012be59bd0b02eff90ee5c /test/unit/data.js
parent76db8a98220b6d76e98536b9578919bfb70048ed (diff)
downloadjquery-515efbdc7119aa79de710144effe18413d4cb14a.tar.gz
jquery-515efbdc7119aa79de710144effe18413d4cb14a.zip
Make sure that undefined is always returned for missing data properties. Follow-up to #6304.
Diffstat (limited to 'test/unit/data.js')
-rw-r--r--test/unit/data.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/unit/data.js b/test/unit/data.js
index 25d519648..77ee09979 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -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" );