aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-05-03 01:51:55 +0000
committerScott González <scott.gonzalez@gmail.com>2008-05-03 01:51:55 +0000
commitf8698395acbe428bd7c3dd6dd5700a0c660deeab (patch)
tree82a20ac1807e15c97c22f72c615a0b5135b08a28 /test
parentad3c49d1b664d282b1e38b2012a0818f0595d2a5 (diff)
downloadjquery-f8698395acbe428bd7c3dd6dd5700a0c660deeab.tar.gz
jquery-f8698395acbe428bd7c3dd6dd5700a0c660deeab.zip
core: Fixed #2605: .data() now accepts null as a value.
Diffstat (limited to 'test')
-rw-r--r--test/unit/core.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index e6321a643..9f46dd4d4 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -1412,16 +1412,21 @@ test("$.data", function() {
});
test(".data()", function() {
- expect(16);
+ expect(18);
var div = $("#foo");
ok( div.data("test") == undefined, "Check for no data exists" );
div.data("test", "success");
ok( div.data("test") == "success", "Check for added data" );
div.data("test", "overwritten");
ok( div.data("test") == "overwritten", "Check for overwritten data" );
-
+ div.data("test", undefined);
+ ok( div.data("test") == "overwritten", "Check that data wasn't removed");
+ div.data("test", null);
+ ok( div.data("test") === null, "Check for null data");
+
+ div.data("test", "overwritten");
var hits = {test:0}, gets = {test:0};
-
+
div
.bind("setData",function(e,key,value){ hits[key] += value; })
.bind("setData.foo",function(e,key,value){ hits[key] += value; })