X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Ftraversing.js;h=0d079f19a4bbbae1b4200c4923352702c663483c;hb=bc05cb9d80b63d8a324a3773a39ac1baa181c4d2;hp=0636f0c33e2ac6defc180d9fcc76e08a09c4978d;hpb=f1f6bc3ec43d86f5b2a0c2b8bf711a2d35930717;p=jquery.git diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 0636f0c..0d079f1 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -1,7 +1,7 @@ module("traversing"); test("find(String)", function() { - expect(3); + expect(5); equals( 'Yahoo', jQuery('#foo').find('.blogTest').text(), 'Check for find' ); // using contents will get comments regular, text, and comment nodes @@ -9,6 +9,8 @@ test("find(String)", function() { equals( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" ); same( jQuery("#main").find("> div").get(), q("foo", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest"), "find child elements" ); + same( jQuery("#main").find("> #foo, > #moretests").get(), q("foo", "moretests"), "find child elements" ); + same( jQuery("#main").find("> #foo > p").get(), q("sndp", "en", "sap"), "find child elements" ); }); test("is(String)", function() { @@ -122,7 +124,7 @@ test("filter(jQuery)", function() { }) test("closest()", function() { - expect(10); + expect(11); same( jQuery("body").closest("body").get(), q("body"), "closest(body)" ); same( jQuery("body").closest("html").get(), q("html"), "closest(html)" ); same( jQuery("body").closest("div").get(), [], "closest(div)" ); @@ -139,7 +141,9 @@ test("closest()", function() { //Test that .closest() returns unique'd set equals( jQuery('#main p').closest('#main').length, 1, "Closest should return a unique set" ); - + + // Test on disconnected node + equals( jQuery("

").find("p").closest("table").length, 0, "Make sure disconnected closest work." ); }); test("closest(Array)", function() {