Tweaked the isXMLDoc iframe test case to test the document, not the body element...
[jquery.git] / test / unit / core.js
index c58f13f..8decd49 100644 (file)
@@ -280,10 +280,10 @@ test("isXMLDoc - HTML", function() {
        document.body.appendChild( iframe );
 
        try {
-               var body = jQuery(iframe).contents().find("body")[0];
-               ok( !jQuery.isXMLDoc( body ), "Iframe body element" );
+               var body = jQuery(iframe).contents()[0];
+               ok( jQuery.isXMLDoc( body ), "Iframe body element" );
        } catch(e){
-               ok( false, "Iframe body element" );
+               ok( false, "Iframe body element exception" );
        }
 
        document.body.removeChild( iframe );
@@ -303,7 +303,7 @@ test("isXMLDoc - XML", function() {
 }
 
 test("jQuery('html')", function() {
-       expect(8);
+       expect(13);
 
        reset();
        jQuery.foo = false;
@@ -313,6 +313,14 @@ test("jQuery('html')", function() {
        jQuery("body").append("<script>jQuery.foo='test';</script>");
        ok( jQuery.foo, "Executing a scripts contents in the right context" );
 
+       // Test multi-line HTML
+       var div = jQuery("<div>\r\nsome text\n<p>some p</p>\nmore text\r\n</div>")[0];
+       equals( div.nodeName.toUpperCase(), "DIV", "Make sure we're getting a div." );
+       equals( div.firstChild.nodeType, 3, "Text node." );
+       equals( div.lastChild.nodeType, 3, "Text node." );
+       equals( div.childNodes[1].nodeType, 1, "Paragraph." );
+       equals( div.childNodes[1].firstChild.nodeType, 3, "Paragraph text." );
+
        reset();
        ok( jQuery("<link rel='stylesheet'/>")[0], "Creating a link" );