diff options
author | InfinitiesLoop <dareed@microsoft.com> | 2010-07-21 05:53:36 +0800 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2010-07-23 03:52:01 +0800 |
commit | 9faab0b74fd316c2161612236d9ea8a01f3c78f8 (patch) | |
tree | ce936d07187d1bb6e695d5fc21de241371fd8edb /test/unit/data.js | |
parent | ef9fb80cabc8c8f9cbcf71bf9160de0abdaa2de8 (diff) | |
download | jquery-9faab0b74fd316c2161612236d9ea8a01f3c78f8.tar.gz jquery-9faab0b74fd316c2161612236d9ea8a01f3c78f8.zip |
Ticket #6808. Changes data() so on plain objects, it uses a function to contain the cache ID to avoid it being JSON serialized.
Diffstat (limited to 'test/unit/data.js')
-rw-r--r-- | test/unit/data.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index d5eb73b08..8a7a87b9d 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." ); }); |