X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=test%2Funit%2Fcore.js;h=98a161fa8ef8bf947c824b9bca97b8fe75a9b90d;hb=eced38a30d21d025db3e219f3cce7239754316d8;hp=07011e8f81399b308e4fc854a7db7a260033e8d8;hpb=122b672f704cca094de50dfef05e88faa84cb51d;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 07011e8..98a161f 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -53,7 +53,7 @@ test("jQuery()", function() { }); test("selector state", function() { - expect(26); + expect(28); var test; @@ -80,6 +80,11 @@ test("selector state", function() { test = jQuery("#main", document.body); equals( test.selector, "#main", "#main Selector" ); equals( test.context, document.body, "#main Context" ); + + // Test cloning + test = jQuery(test); + equals( test.selector, "#main", "#main Selector" ); + equals( test.context, document.body, "#main Context" ); test = jQuery(document.body).find("#main"); equals( test.selector, "#main", "#main find Selector" ); @@ -291,9 +296,10 @@ test("jQuery(selector, xml).text(str) - Loaded via XML document", function() { stop(); jQuery.get('data/dashboard.xml', function(xml) { // tests for #1419 where IE was a problem - equals( jQuery("tab:first", xml).text(), "blabla", "Verify initial text correct" ); - jQuery("tab:first", xml).text("newtext"); - equals( jQuery("tab:first", xml).text(), "newtext", "Verify new text correct" ); + var tab = jQuery("tab", xml).eq(0); + equals( tab.text(), "blabla", "Verify initial text correct" ); + tab.text("newtext"); + equals( tab.text(), "newtext", "Verify new text correct" ); start(); }); }); @@ -561,7 +567,7 @@ test("attr('tabindex')", function() { equals(jQuery('#divWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, not tabbable by default'); // link without a tabindex - equals(jQuery('#linkWithNoTabIndex').attr('tabindex'), undefined, 'no tabindex, tabbable by default'); + equals(jQuery('#linkWithNoTabIndex').attr('tabindex'), 0, 'no tabindex, tabbable by default'); }); test("attr('tabindex', value)", function() { @@ -1167,10 +1173,12 @@ test("clone() on XML nodes", function() { stop(); jQuery.get("data/dashboard.xml", function (xml) { var root = jQuery(xml.documentElement).clone(); - jQuery("tab:first", xml).text("origval"); - jQuery("tab:first", root).text("cloneval"); - equals(jQuery("tab:first", xml).text(), "origval", "Check original XML node was correctly set"); - equals(jQuery("tab:first", root).text(), "cloneval", "Check cloned XML node was correctly set"); + var origTab = jQuery("tab", xml).eq(0); + var cloneTab = jQuery("tab", root).eq(0); + origTab.text("origval"); + cloneTab.text("cloneval"); + equals(origTab.text(), "origval", "Check original XML node was correctly set"); + equals(cloneTab.text(), "cloneval", "Check cloned XML node was correctly set"); start(); }); }); @@ -1557,7 +1565,7 @@ test("removeClass(String) - simple", function() { }); test("toggleClass(String)", function() { - expect(6); + expect(6); var e = jQuery("#firstp"); ok( !e.is(".test"), "Assert class not present" ); e.toggleClass("test"); @@ -1565,12 +1573,12 @@ test("toggleClass(String)", function() { e.toggleClass("test"); ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass("test", false); - ok( !e.is(".test"), "Assert class not present" ); - e.toggleClass("test", true); - ok( e.is(".test"), "Assert class present" ); - e.toggleClass("test", false); - ok( !e.is(".test"), "Assert class not present" ); + e.toggleClass("test", false); + ok( !e.is(".test"), "Assert class not present" ); + e.toggleClass("test", true); + ok( e.is(".test"), "Assert class present" ); + e.toggleClass("test", false); + ok( !e.is(".test"), "Assert class not present" ); }); test("removeAttr(String", function() {