aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-07-28 12:28:59 +0000
committerJohn Resig <jeresig@gmail.com>2009-07-28 12:28:59 +0000
commitd6991fa273515a8503692324499edcc71b5c3f64 (patch)
tree74e6d461e7644d178441dfb9343eab2160acce41 /test/unit
parent61b18c866c57f9156f746b691517649f2ce628aa (diff)
downloadjquery-d6991fa273515a8503692324499edcc71b5c3f64.tar.gz
jquery-d6991fa273515a8503692324499edcc71b5c3f64.zip
Added support for .closest(filter, DOMElement). Fixes #4072.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/traversing.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index f585d9ca4..1a7e6ee80 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -91,7 +91,7 @@ test("filter(jQuery)", function() {
})
test("closest()", function() {
- expect(6);
+ expect(9);
isSet( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
isSet( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
isSet( jQuery("body").closest("div").get(), [], "closest(div)" );
@@ -99,6 +99,12 @@ test("closest()", function() {
isSet( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
isSet( jQuery("div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
+
+ // Test .closest() limited by the context
+ var jq = jQuery("#nothiddendivchild");
+ isSet( jq.closest("html", document.body).get(), [], "Context limited." );
+ isSet( jq.closest("body", document.body).get(), [], "Context limited." );
+ isSet( jq.closest("#nothiddendiv", document.body).get(), q("nothiddendiv"), "Context not reached." );
});
test("not(Selector)", function() {