]> source.dussan.org Git - jquery.git/commitdiff
Tests: do not create data cache when fetching single property
authorJason Bedard <jason+github@jbedard.ca>
Sun, 23 Aug 2015 21:23:35 +0000 (14:23 -0700)
committerMichał Gołębiowski <m.goleb@gmail.com>
Tue, 8 Sep 2015 00:02:51 +0000 (02:02 +0200)
(test cherry-picked from f5bf9bc48897e3b8f050d87d02252c8be456044a)
Refs gh-2554

test/unit/data.js

index e5ee6d18462cdcfa90a625f431dbd2f808564104..adade2a5f27fd68244d46ebfa8b1d5a4d0c48ac5 100644 (file)
@@ -1121,3 +1121,19 @@ testIframeWithCallback(
                );
        }
 );
+
+QUnit.test( ".data(prop) does not create expando", function( assert ) {
+       assert.expect( 1 );
+
+       var key,
+               div = jQuery( "<div/>" );
+
+       div.data("foo");
+       assert.equal( false, jQuery.hasData( div[0] ) );
+       // Make sure no expando has been added
+       for ( key in div[ 0 ] ) {
+               if ( /^jQuery/.test( key ) ) {
+                       assert.ok( false, "Expando was created on access" );
+               }
+       }
+} );