aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2011-09-19 21:16:20 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 21:16:20 -0400
commit9b3768b968bc99d3422355e69e2c7c35bedf681e (patch)
tree74de01c5c901b166900a4ca563a41f3ce02c70b2 /test
parentca4133cc3fb4202d08de0d9e9d05e2442be63653 (diff)
downloadjquery-9b3768b968bc99d3422355e69e2c7c35bedf681e.tar.gz
jquery-9b3768b968bc99d3422355e69e2c7c35bedf681e.zip
Landing pull request 512. 1.7 - removeData now takes space separated lists and arrays of keys - Fixes #7323.
More Details: - https://github.com/jquery/jquery/pull/512 - http://bugs.jquery.com/ticket/7323
Diffstat (limited to 'test')
-rw-r--r--test/unit/data.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/unit/data.js b/test/unit/data.js
index 4feba32c0..0e9c354db 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -434,7 +434,7 @@ test(".data(Object)", function() {
});
test("jQuery.removeData", function() {
- expect(6);
+ expect(10);
var div = jQuery("#foo")[0];
jQuery.data(div, "test", "testing");
jQuery.removeData(div, "test");
@@ -445,6 +445,28 @@ test("jQuery.removeData", function() {
ok( !jQuery.data(div, "test2"), "Make sure that the data property no longer exists." );
ok( !div[ jQuery.expando ], "Make sure the expando no longer exists, as well." );
+ jQuery.data(div, {
+ test3: "testing",
+ test4: "testing"
+ });
+ jQuery.removeData( div, "test3 test4" );
+ ok( !jQuery.data(div, "test3") || jQuery.data(div, "test4"), "Multiple delete with spaces." );
+
+ jQuery.data(div, {
+ test3: "testing",
+ test4: "testing"
+ });
+ jQuery.removeData( div, [ "test3", "test4" ] );
+ ok( !jQuery.data(div, "test3") || jQuery.data(div, "test4"), "Multiple delete by array." );
+
+ jQuery.data(div, {
+ "test3 test4": "testing",
+ test3: "testing"
+ });
+ jQuery.removeData( div, "test3 test4" );
+ ok( !jQuery.data(div, "test3 test4"), "Multiple delete with spaces deleted key with exact name" );
+ ok( jQuery.data(div, "test3"), "Left the partial matched key alone" );
+
var obj = {};
jQuery.data(obj, "test", "testing");
equals( jQuery(obj).data("test"), "testing", "verify data on plain object");