diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-05-03 01:51:55 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-05-03 01:51:55 +0000 |
commit | f8698395acbe428bd7c3dd6dd5700a0c660deeab (patch) | |
tree | 82a20ac1807e15c97c22f72c615a0b5135b08a28 /test | |
parent | ad3c49d1b664d282b1e38b2012a0818f0595d2a5 (diff) | |
download | jquery-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.js | 11 |
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; })
|