diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2015-05-06 15:29:06 -0700 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-05-12 10:09:40 -0400 |
commit | 56bb677725b21415905e5c3eeb1e05be4480e780 (patch) | |
tree | 6ea93a20973e78f466412eeb58957af7e9075bdf /test/unit/data.js | |
parent | 764dc949d0d65742606747ce75852d1b5dd59fcd (diff) | |
download | jquery-56bb677725b21415905e5c3eeb1e05be4480e780.tar.gz jquery-56bb677725b21415905e5c3eeb1e05be4480e780.zip |
Data: remove the expando when there's no more data
Fixes gh-1760
Close gh-2271
Diffstat (limited to 'test/unit/data.js')
-rw-r--r-- | test/unit/data.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index c08550b1b..20e5af828 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -837,7 +837,24 @@ test("Check proper data removal of non-element descendants nodes (#8335)", 1, fu }); testIframeWithCallback( "enumerate data attrs on body (#14894)", "data/dataAttrs.html", function( result ) { - expect(1); + expect( 1 ); + + equal( result, "ok", "enumeration of data- attrs on body" ); +}); + +test( "Check that the expando is removed when there's no more data", function() { + expect( 1 ); - equal(result, "ok", "enumeration of data- attrs on body" ); + var key, + div = jQuery( "<div/>" ); + div.data( "some", "data" ); + equal( div.data( "some" ), "data", "Data is added" ); + div.removeData( "some" ); + + // Make sure the expando is gone + for ( key in div[ 0 ] ) { + if ( /^jQuery/.test( key ) ) { + ok( false, "Expando was not removed when there was no more data" ); + } + } }); |