X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=c58f13f35e9660d0f087260c46eb0f74f35552d3;hb=2cd9ee3510a03091c929b849ea164c9f97e262e7;hp=28be6533624ae4dadda328aaa297da0bc1659690;hpb=cae93c39eb57ccc2acc5e101eda7a56e0a734cdf;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 28be653..c58f13f 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -269,6 +269,39 @@ test("isFunction", function() { }); }); +test("isXMLDoc - HTML", function() { + expect(4); + + ok( !jQuery.isXMLDoc( document ), "HTML document" ); + ok( !jQuery.isXMLDoc( document.documentElement ), "HTML documentElement" ); + ok( !jQuery.isXMLDoc( document.body ), "HTML Body Element" ); + + var iframe = document.createElement("iframe"); + document.body.appendChild( iframe ); + + try { + var body = jQuery(iframe).contents().find("body")[0]; + ok( !jQuery.isXMLDoc( body ), "Iframe body element" ); + } catch(e){ + ok( false, "Iframe body element" ); + } + + document.body.removeChild( iframe ); +}); + +if ( !isLocal ) { +test("isXMLDoc - XML", function() { + expect(3); + stop(); + jQuery.get('data/dashboard.xml', function(xml) { + ok( jQuery.isXMLDoc( xml ), "XML document" ); + ok( jQuery.isXMLDoc( xml.documentElement ), "XML documentElement" ); + ok( jQuery.isXMLDoc( jQuery("tab", xml)[0] ), "XML Tab Element" ); + start(); + }); +}); +} + test("jQuery('html')", function() { expect(8); @@ -611,4 +644,4 @@ test("jQuery.isEmptyObject", function(){ // What about this ? // equals(true, jQuery.isEmptyObject(null), "isEmptyObject on null" ); -}); \ No newline at end of file +});