X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=bc1def38928c2509a109e9d1a218245db0f19e7f;hb=d44e9451f789db40e7cb370717258c00dff10edd;hp=d69696a1e4a44a6cb0b7058f9657d5f23fe7496b;hpb=74a132d944886379456d562990c8fb217ab332e3;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index d69696a..bc1def3 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -173,7 +173,19 @@ test("$('html', context)", function() { var $div = $("
"); var $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("

xxx

").add("

xxx

"); 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(); }); });