From b8013581ced78fb6c2005e76b44211e01fc2e466 Mon Sep 17 00:00:00 2001 From: timmywil Date: Wed, 23 Mar 2011 15:56:05 -0400 Subject: [PATCH] Closest unit tests: add one for passing a jQuery collection with multiple elements --- test/unit/traversing.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/traversing.js b/test/unit/traversing.js index bd05f470c..adca5f401 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -183,10 +183,11 @@ test("closest(Array)", function() { }); test("closest(jQuery)", function() { - expect(7); + expect(8); var $child = jQuery("#nothiddendivchild"), $parent = jQuery("#nothiddendiv"), - $main = jQuery("#main"); + $main = jQuery("#main"), + $body = jQuery("body"); ok( $child.closest( $parent ).is('#nothiddendiv'), "closest( jQuery('#nothiddendiv') )" ); ok( $child.closest( $parent[0] ).is('#nothiddendiv'), "closest( jQuery('#nothiddendiv') ) :: node" ); ok( $child.closest( $child ).is('#nothiddendivchild'), "child is included" ); @@ -194,6 +195,7 @@ test("closest(jQuery)", function() { equals( $child.closest( document.createElement('div') ).length, 0, "created element is not related" ); equals( $child.closest( $main ).length, 0, "Main not a parent of child" ); equals( $child.closest( $main[0] ).length, 0, "Main not a parent of child :: node" ); + ok( $child.closest( $body.add($parent) ).is('#nothiddendiv'), "Closest ancestor retrieved." ); }); test("not(Selector)", function() { -- 2.39.5