- 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.prop, "Data is being stored on the object" );
+ equals( jQuery.data( obj, "prop" ), true, "Make sure the right value is retrieved" );
+
+ jQuery.data( window, "BAD", true );
+ ok( !window[ jQuery.expando ], "Make sure there is no expando on the window object." );
+ ok( !window.BAD, "And make sure that the property wasn't set directly on the window." );
+ ok( jQuery.data( window, "BAD" ), "Make sure that the value was set." );
+});
+
+test("jQuery.hasData", function() {
+ expect(6);
+
+ function testData(obj) {
+ equals( jQuery.hasData(obj), false, "No data exists" );
+ jQuery.data( obj, "foo", "bar" );
+ equals( jQuery.hasData(obj), true, "Data exists" );
+ jQuery.removeData( obj, "foo" );
+ equals( jQuery.hasData(obj), false, "Data was removed" );
+ }