X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fdata.js;h=f87d7ae4fa8125d18fcff6c3244d0a9f6a42c61d;hb=1f8a5e4bbc49c244051101765c46bd8f35e2aa32;hp=68e24b63dbf0c2b5edd6fb9e7954eeb8962f42a5;hpb=d5d4e4df65b56319b4f1216f63008a9751690315;p=jquery.git diff --git a/test/unit/data.js b/test/unit/data.js index 68e24b6..f87d7ae 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -158,7 +158,7 @@ test(".data(String) and .data(String, Object)", function() { }); test("data-* attributes", function() { - expect(22); + expect(24); var div = jQuery("
"), child = jQuery("
"); @@ -186,6 +186,8 @@ test("data-* attributes", function() { .attr("data-point", "5.5") .attr("data-pointbad", "5..5") .attr("data-pointbad2", "-.") + .attr("data-badjson", "{123}") + .attr("data-badjson2", "[abc]") .attr("data-null", "null") .attr("data-string", "test"); @@ -195,6 +197,8 @@ test("data-* attributes", function() { equals( child.data('point'), 5.5, "Primitive number read from attribute"); equals( child.data('pointbad'), "5..5", "Bad number read from attribute"); equals( child.data('pointbad2'), "-.", "Bad number read from attribute"); + equals( child.data('badjson'), "{123}", "Bad number read from attribute"); + equals( child.data('badjson2'), "[abc]", "Bad number read from attribute"); equals( child.data('null'), null, "Primitive null read from attribute"); equals( child.data('string'), "test", "Typical string read from attribute"); @@ -213,11 +217,11 @@ test("data-* attributes", function() { break; case 2: equals(jQuery(elem).data("zoooo"), "bar", "Check zoooo property"); - equals(jQuery(elem).data("bar"), '{"test":"baz"}', "Check bar property"); + same(jQuery(elem).data("bar"), {"test":"baz"}, "Check bar property"); break; case 3: equals(jQuery(elem).data("number"), true, "Check number property"); - equals(jQuery(elem).data("stuff"), "[2,8]", "Check stuff property"); + same(jQuery(elem).data("stuff"), [2,8], "Check stuff property"); break; default: ok(false, ["Assertion failed on index ", index, ", with data ", data].join(''));