aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-03-23 15:56:05 -0400
committertimmywil <tim.willison@thisismedium.com>2011-03-23 15:56:05 -0400
commitb8013581ced78fb6c2005e76b44211e01fc2e466 (patch)
treef5ece4760b63d5d97b1b08541fea18ffb53a1f1b /test
parente09d8898d8a8df27bb72ebc64a4cd08c11f21ddd (diff)
downloadjquery-b8013581ced78fb6c2005e76b44211e01fc2e466.tar.gz
jquery-b8013581ced78fb6c2005e76b44211e01fc2e466.zip
Closest unit tests: add one for passing a jQuery collection with multiple elements
Diffstat (limited to 'test')
-rw-r--r--test/unit/traversing.js6
1 files 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() {