aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/traversing.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-02 19:05:51 -0500
committerjeresig <jeresig@gmail.com>2009-12-02 19:05:51 -0500
commite534a310c7e99c44d93855ad5865ad5e985039ba (patch)
tree46832f782b6ec16f5eabc0993479619939b70428 /test/unit/traversing.js
parent62436f4b292aadfe5419f897d7b8504054ab1c8c (diff)
downloadjquery-e534a310c7e99c44d93855ad5865ad5e985039ba.tar.gz
jquery-e534a310c7e99c44d93855ad5865ad5e985039ba.zip
Added in the new .closest(Array) method, will be used to improve the performance of live filtering.
Diffstat (limited to 'test/unit/traversing.js')
-rw-r--r--test/unit/traversing.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 780d30f19..22d486812 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -107,6 +107,17 @@ test("closest()", function() {
same( jq.closest("#nothiddendiv", document.body).get(), q("nothiddendiv"), "Context not reached." );
});
+test("closest(Array)", function() {
+ expect(6);
+ same( jQuery("body").closest(["body"]), [{selector:"body", elem:document.body}], "closest([body])" );
+ same( jQuery("body").closest(["html"]), [{selector:"html", elem:document.documentElement}], "closest([html])" );
+ same( jQuery("body").closest(["div"]), [], "closest([div])" );
+ same( jQuery("#main").closest(["span,#html"]), [{selector:"span,#html", elem:document.documentElement}], "closest([span,#html])" );
+
+ same( jQuery("body").closest(["body","html"]), [{selector:"body", elem:document.body}, {selector:"html", elem:document.documentElement}], "closest([body, html])" );
+ same( jQuery("body").closest(["span","html"]), [{selector:"html", elem:document.documentElement}], "closest([body, html])" );
+});
+
test("not(Selector)", function() {
expect(7);
equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" );