aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorrwldrn <waldron.rick@gmail.com>2011-06-06 20:18:36 -0400
committertimmywil <tim.willison@thisismedium.com>2011-06-06 20:18:36 -0400
commit07420566452622f37b01e69bbbdcbeeb5317e065 (patch)
tree1241a1581826dba50e32a3511e11b901177557f2 /test
parentc3c001cf5b0970457cc9d7492cb66bdc9a901a1e (diff)
downloadjquery-07420566452622f37b01e69bbbdcbeeb5317e065.tar.gz
jquery-07420566452622f37b01e69bbbdcbeeb5317e065.zip
Landing pull request 403. Check for both camelized and hyphenated data property names; Fixes #9301.
More Details: - https://github.com/jquery/jquery/pull/403 - http://bugs.jquery.com/ticket/9301
Diffstat (limited to 'test')
-rw-r--r--test/unit/data.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/data.js b/test/unit/data.js
index 1af2077ec..87a3de339 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -508,3 +508,20 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
div.remove();
});
+
+test("jQuery.data should not miss data with preset hyphenated property names", function() {
+
+ expect(2);
+
+ var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),
+ test = {
+ "camelBar": "camelBar",
+ "hyphen-foo": "hyphen-foo"
+ };
+
+ div.data( test );
+
+ jQuery.each( test , function(i, k) {
+ equal( div.data(k), k, "data with property '"+k+"' was correctly found");
+ });
+});