Skip to content
Permalink
Browse files

Closest unit tests: add one for passing a jQuery collection with mult…

…iple elements
  • Loading branch information...
timmywil
timmywil committed Mar 23, 2011
1 parent e09d889 commit b8013581ced78fb6c2005e76b44211e01fc2e466
Showing with 4 additions and 2 deletions.
  1. +4 −2 test/unit/traversing.js
@@ -183,17 +183,19 @@ 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" );
ok( $child.closest( $child[0] ).is('#nothiddendivchild'), "child is included :: node" );
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() {

0 comments on commit b801358

Please sign in to comment.
You can’t perform that action at this time.