aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/traversing.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-07-25 21:31:59 +0000
committerJohn Resig <jeresig@gmail.com>2009-07-25 21:31:59 +0000
commitcae93c39eb57ccc2acc5e101eda7a56e0a734cdf (patch)
tree06fe36a01ff668f449a541aadeffb4dfd690ea5c /test/unit/traversing.js
parent343b0936a43953a993d1f2cc500b954d5bcc8280 (diff)
downloadjquery-cae93c39eb57ccc2acc5e101eda7a56e0a734cdf.tar.gz
jquery-cae93c39eb57ccc2acc5e101eda7a56e0a734cdf.zip
Implemented support for .context limited .closest() calls. Fixes #4072.
Diffstat (limited to 'test/unit/traversing.js')
-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..16f6043e8 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", document.body);
+ isSet( jq.closest("html").get(), [], "Context limited." );
+ isSet( jq.closest("body").get(), [], "Context limited." );
+ isSet( jq.closest("#nothiddendiv").get(), q("nothiddendiv"), "Context not reached." );
});
test("not(Selector)", function() {