diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2013-02-28 14:14:40 -0500 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2013-02-28 14:14:40 -0500 |
commit | 38bc968052f7f20af48626b6739f312224314348 (patch) | |
tree | 6ca1822a16b5f5cd46ca60ea255e499daac5596b | |
parent | 054c6946d4f86e4ba5ce6284554c8cacd7498e93 (diff) | |
download | jquery-38bc968052f7f20af48626b6739f312224314348.tar.gz jquery-38bc968052f7f20af48626b6739f312224314348.zip |
Old acceptData tests refactored and adapted to support new data system
-rw-r--r-- | test/unit/data.js | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index 64cd04e90..2eb48e742 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -144,42 +144,36 @@ test("jQuery.data(document)", 25, function() { QUnit.expectJqData(document, "foo"); }); +test("jQuery.data(<embed>)", 25, function() { + dataTests( document.createElement("embed") ); +}); -/* -// Since the new data system does not rely on expandos, limiting the type of -// nodes that can have data is no longer necessary. jQuery.acceptData is now irrelevant -// and should eventually be removed from the library. - -test("Data is not being set on comment and text nodes", function() { - expect(2); - - ok( !jQuery.hasData( jQuery("<!-- comment -->").data("foo", 0) ) ); - ok( !jQuery.hasData( jQuery("<span>text</span>").contents().data("foo", 0) ) ); - +test("jQuery.data(<applet>)", 25, function() { + dataTests( document.createElement("applet") ); }); +test("jQuery.data(object/flash)", 25, function() { + var flash = document.createElement("object"); + flash.setAttribute( "classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ); -test("jQuery.acceptData", function() { - expect(9); + dataTests( flash ); +}); - ok( jQuery.acceptData( document ), "document" ); - ok( jQuery.acceptData( document.documentElement ), "documentElement" ); - ok( jQuery.acceptData( {} ), "object" ); - ok( !jQuery.acceptData( document.createElement("embed") ), "embed" ); - ok( !jQuery.acceptData( document.createElement("applet") ), "applet" ); +test("jQuery.data(object/applet)", 25, function() { + var applet = document.createElement("object"); + applet.setAttribute( "classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ); - var flash = document.createElement("object"); - flash.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"); - ok( jQuery.acceptData( flash ), "flash" ); + dataTests( applet ); +}); - var applet = document.createElement("object"); - applet.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"); - ok( !jQuery.acceptData( applet ), "applet" ); +test("jQuery.data(comment)", 25, function() { + dataTests( document.createComment("") ); +}); - ok( !jQuery.acceptData( document.createComment("") ), "comment" ); - ok( !jQuery.acceptData( document.createTextNode("") ), "text" ); +test("jQuery.data(text)", 25, function() { + dataTests( document.createTextNode("") ); }); -*/ + test(".data()", function() { expect(5); |