Skip to content

Commit 7daf44b

Browse files
committed
Adds failing tests for #9413
1 parent e18cad6 commit 7daf44b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/data.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,31 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
551551
});
552552
});
553553

554+
test("jQuery.data supports interoperable removal of hyphenated/camelCase properties", function() {
555+
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
556+
datas = {
557+
"non-empty": "a string",
558+
"empty-string": "",
559+
"one-value": 1,
560+
"zero-value": 0,
561+
"an-array": [],
562+
"an-object": {},
563+
"bool-true": true,
564+
"bool-false": false,
565+
"some-json": '{ "foo": "bar" }'
566+
};
567+
568+
expect( 27 );
569+
570+
jQuery.each( datas, function( key, val ) {
571+
div.data( key, val );
572+
573+
deepEqual( div.data( key ), val, "get: " + key );
574+
deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
575+
576+
div.removeData( key );
577+
578+
equal( div.data( key ), undefined, "get: " + key );
579+
580+
});
581+
});

0 commit comments

Comments
 (0)