diff options
Diffstat (limited to 'test/unit/data.js')
-rw-r--r-- | test/unit/data.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index 3a90c0054..bb66447f0 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -819,32 +819,31 @@ QUnit.test( ".data doesn't throw when calling selection is empty. #13551", funct } } ); -QUnit.test( "jQuery.acceptData", function( assert ) { +QUnit.test( "acceptData", function( assert ) { assert.expect( 10 ); - var flash, pdf; + var flash, pdf, form; - assert.ok( jQuery.acceptData( document ), "document" ); - assert.ok( jQuery.acceptData( document.documentElement ), "documentElement" ); - assert.ok( jQuery.acceptData( {} ), "object" ); - assert.ok( jQuery.acceptData( document.createElement( "embed" ) ), "embed" ); + assert.equal( 42, jQuery( document ).data( "test", 42 ).data( "test" ), "document" ); + assert.equal( 42, jQuery( document.documentElement ).data( "test", 42 ).data( "test" ), "documentElement" ); + assert.equal( 42, jQuery( {} ).data( "test", 42 ).data( "test" ), "object" ); + assert.equal( 42, jQuery( document.createElement( "embed" ) ).data( "test", 42 ).data( "test" ), "embed" ); flash = document.createElement( "object" ); flash.setAttribute( "classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ); - assert.ok( jQuery.acceptData( flash ), "flash" ); + assert.equal( 42, jQuery( flash ).data( "test", 42 ).data( "test" ), "flash" ); pdf = document.createElement( "object" ); pdf.setAttribute( "classid", "clsid:CA8A9780-280D-11CF-A24D-444553540000" ); - assert.ok( jQuery.acceptData( pdf ), "pdf" ); + assert.equal( 42, jQuery( pdf ).data( "test", 42 ).data( "test" ), "pdf" ); - assert.ok( !jQuery.acceptData( document.createComment( "" ) ), "comment" ); - assert.ok( !jQuery.acceptData( document.createTextNode( "" ) ), "text" ); - assert.ok( !jQuery.acceptData( document.createDocumentFragment() ), "documentFragment" ); + assert.equal( undefined, jQuery( document.createComment( "" ) ).data( "test", 42 ).data( "test" ), "comment" ); + assert.equal( undefined, jQuery( document.createTextNode( "" ) ).data( "test", 42 ).data( "test" ), "text" ); + assert.equal( undefined, jQuery( document.createDocumentFragment() ).data( "test", 42 ).data( "test" ), "documentFragment" ); - assert.ok( jQuery.acceptData( - jQuery( "#form" ).append( "<input id='nodeType'/><input id='nodeName'/>" )[ 0 ] ), - "form with aliased DOM properties" ); -} ); + form = jQuery( "#form" ).append( "<input id='nodeType'/><input id='nodeName'/>" )[ 0 ]; + assert.equal( 42, jQuery( form ) .data( "test", 42 ).data( "test" ), "form with aliased DOM properties" ); +}); QUnit.test( "Check proper data removal of non-element descendants nodes (#8335)", function( assert ) { assert.expect( 1 ); |