X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fdata.js;h=872bbb753067dced760af96bc28fd8f5051cae0c;hb=90a4abd5111e57213059eb80876551ae1fac6c53;hp=d5eb73b080ce31aa6c18e1faaeb009fadd3d4f7d;hpb=2e10af143b7eafb7142524f6534a62aee1910bd1;p=jquery.git diff --git a/test/unit/data.js b/test/unit/data.js index d5eb73b..872bbb7 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -1,13 +1,14 @@ module("data"); test("expando", function(){ - expect(6); + expect(7); equals("expando" in jQuery, true, "jQuery is exposing the expando"); var obj = {}; jQuery.data(obj); equals( jQuery.expando in obj, true, "jQuery.data adds an expando to the object" ); + equals( typeof obj[jQuery.expando], "function", "jQuery.data adds an expando to the object as a function" ); obj = {}; jQuery.data(obj, 'test'); @@ -17,7 +18,7 @@ test("expando", function(){ jQuery.data(obj, "foo", "bar"); equals( jQuery.expando in obj, true, "jQuery.data added an expando to the object" ); - var id = obj[jQuery.expando]; + var id = obj[jQuery.expando](); equals( id in jQuery.cache, false, "jQuery.data did not add an entry to jQuery.cache" ); equals( id.foo, "bar", "jQuery.data worked correctly" ); @@ -54,7 +55,7 @@ test("jQuery.data", function() { jQuery.data( obj, "prop", true ); ok( obj[ jQuery.expando ], "Data is being stored on the object." ); - ok( obj[ jQuery.expando ].prop, "Data is being stored on the object." ); + ok( obj[ jQuery.expando ]().prop, "Data is being stored on the object." ); equals( jQuery.data( obj, "prop" ), true, "Make sure the right value is retrieved." ); }); @@ -69,7 +70,13 @@ test(".data()", function() { test(".data(String) and .data(String, Object)", function() { expect(27); - var div = jQuery("
"); + var parent = jQuery("
"), + div = parent.children(); + + parent + .bind("getData", function(){ ok( false, "getData bubbled." ) }) + .bind("setData", function(){ ok( false, "setData bubbled." ) }) + .bind("changeData", function(){ ok( false, "changeData bubbled." ) }); ok( div.data("test") === undefined, "Check for no data exists" );