From 67c7b46ea36946c85d119d2c513486d2b1a05a24 Mon Sep 17 00:00:00 2001 From: Brandon Aaron Date: Sun, 16 Dec 2007 04:04:29 +0000 Subject: [PATCH] Adding data and removeData tests --- test/unit/core.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/unit/core.js b/test/unit/core.js index 03f89d1cc..a6ae6e415 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1262,6 +1262,24 @@ test("$.className", function() { ok( c.has(x, "bar"), "Check has2" ); }); +test("$.data", function() { + expect(3); + var div = $("#foo")[0]; + ok( jQuery.data(div, "test") == undefined, "Check for no data exists" ); + jQuery.data(div, "test", "success"); + ok( jQuery.data(div, "test") == "success", "Check for added data" ); + jQuery.data(div, "test", "overwritten"); + ok( jQuery.data(div, "test") == "overwritten", "Check for overwritten data" ); +}); + +test("$.removeData", function() { + expect(1); + var div = $("#foo")[0]; + jQuery.data(div, "test", "testing"); + jQuery.removeData(div, "test"); + ok( jQuery.data(div, "test") == undefined, "Check removal of data" ); +}); + test("remove()", function() { expect(6); $("#ap").children().remove(); @@ -1350,4 +1368,4 @@ test("contents()", function() { var c = $("#nonnodes").contents().contents(); equals( c.length, 1, "Check node,textnode,comment contents is just one" ); equals( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" ); -}); +}); \ No newline at end of file -- 2.39.5