]> source.dussan.org Git - jquery.git/commitdiff
Adds failing tests for #9413
authorRick Waldron <waldron.rick@gmail.com>
Fri, 5 Aug 2011 13:43:15 +0000 (09:43 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Fri, 5 Aug 2011 13:43:15 +0000 (09:43 -0400)
test/unit/data.js

index c62bd1cc10c6d3b9a8c34e3096ad147073d1a8b1..55201b4e33f9f4e134fb7e02f713f0e9d7c22f2e 100644 (file)
@@ -551,3 +551,31 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
        });
 });
 
+test("jQuery.data supports interoperable removal of hyphenated/camelCase properties", function() {
+       var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
+               datas = {
+                       "non-empty": "a string",
+                       "empty-string": "",
+                       "one-value": 1,
+                       "zero-value": 0,
+                       "an-array": [],
+                       "an-object": {},
+                       "bool-true": true,
+                       "bool-false": false,
+                       "some-json": '{ "foo": "bar" }'
+               };
+
+       expect( 27 );
+
+       jQuery.each( datas, function( key, val ) {
+               div.data( key, val );
+
+               deepEqual( div.data( key ), val, "get: " + key );
+               deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
+
+               div.removeData( key );
+
+               equal( div.data( key ), undefined, "get: " + key );
+
+       });
+});
\ No newline at end of file