From 087409679716f85fff6fa497a3b7efd1620e31ec Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Sun, 23 Aug 2015 14:23:35 -0700 Subject: [PATCH] Tests: do not create data cache when fetching single property (test cherry-picked from f5bf9bc48897e3b8f050d87d02252c8be456044a) Refs gh-2554 --- test/unit/data.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/unit/data.js b/test/unit/data.js index e5ee6d184..adade2a5f 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -1121,3 +1121,19 @@ testIframeWithCallback( ); } ); + +QUnit.test( ".data(prop) does not create expando", function( assert ) { + assert.expect( 1 ); + + var key, + div = jQuery( "
" ); + + 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" ); + } + } +} ); -- 2.39.5