Fix for #2002
[jquery.git] / test / unit / core.js
index d69696a..bc1def3 100644 (file)
@@ -173,7 +173,19 @@ test("$('html', context)", function() {
 
        var $div = $("<div/>");
        var $span = $("<span/>", $div);
-       equals($span.length, 1, "Verify a span created with a div context works");
+       equals($span.length, 1, "Verify a span created with a div context works, #1763");
+});
+
+test("$(selector, xml).text(str) - Loaded via XML document", function() {
+       expect(2);
+       stop();
+       $.get('data/dashboard.xml', function(xml) { 
+               // tests for #1419 where IE was a problem
+               equals( $("tab:first", xml).text(), "blabla", "Verify initial text correct" );
+               $("tab:first", xml).text("newtext");
+               equals( $("tab:first", xml).text(), "newtext", "Verify new text correct" );
+               start();
+       });
 });
 
 test("length", function() {
@@ -196,8 +208,8 @@ test("get(Number)", function() {
        ok( $("p").get(0) == document.getElementById("firstp"), "Get A Single Element" );
 });
 
-test("add(String|Element|Array)", function() {
-       expect(7);
+test("add(String|Element|Array|undefined)", function() {
+       expect(8);
        isSet( $("#sndp").add("#en").add("#sap").get(), q("sndp", "en", "sap"), "Check elements from document" );
        isSet( $("#sndp").add( $("#en")[0] ).add( $("#sap") ).get(), q("sndp", "en", "sap"), "Check elements from document" );
        ok( $([]).add($("#form")[0].elements).length >= 13, "Check elements from array" );
@@ -209,6 +221,9 @@ test("add(String|Element|Array)", function() {
        var x = $([]).add("<p id='x1'>xxx</p>").add("<p id='x2'>xxx</p>");
        ok( x[0].id == "x1", "Check on-the-fly element1" );
        ok( x[1].id == "x2", "Check on-the-fly element2" );
+       
+       var notDefined;
+       equals( $([]).add(notDefined).length, 0, "Check that undefined adds nothing." );
 });
 
 test("each(Function)", function() {
@@ -355,8 +370,8 @@ if ( !isLocal ) {
               $('tab', xml).each(function() {
                     titles.push($(this).attr('title'));
               });
-              ok( titles[0] == 'Location', 'attr() in XML context: Check first title' );
-              ok( titles[1] == 'Users', 'attr() in XML context: Check second title' );
+              equals( titles[0], 'Location', 'attr() in XML context: Check first title' );
+              equals( titles[1], 'Users', 'attr() in XML context: Check second title' );
               start();
         });
     });