aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-09 15:19:40 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-09 15:19:40 +0000
commitea283bd13130303271077a6ee8b14b7c79bd0ce4 (patch)
tree997e676e82784ffdbeee81ba68d2de369c04c1a5
parentaa424984f7c37956f568512aa94bc16787e4c651 (diff)
downloadjquery-ea283bd13130303271077a6ee8b14b7c79bd0ce4.tar.gz
jquery-ea283bd13130303271077a6ee8b14b7c79bd0ce4.zip
Added test and fixed parents()
-rw-r--r--src/jquery/coreTest.js10
-rw-r--r--src/jquery/jquery.js2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js
index 7be53f738..58616dba1 100644
--- a/src/jquery/coreTest.js
+++ b/src/jquery/coreTest.js
@@ -388,6 +388,15 @@ test("children([String])", function() {
isSet( $("#foo").children("[code]").get(), q("sndp", "sap"), "Check for filtered children" );
});
+test("parent[s]([String])", function() {
+ ok( $("#groups").parent()[0].id == "ap", "Simple parent check" );
+ ok( $("#groups").parent("p")[0].id == "ap", "Filtered parent check" );
+ ok( $("#groups").parent("div").length == 0, "Filtered parent check, no match" );
+
+ ok( $("#groups").parents()[0].id == "ap", "Simple parents check" );
+ ok( $("#groups").parents("p")[0].id == "ap", "Filtered parents check" );
+ ok( $("#groups").parents("div")[0].id == "main", "Filtered parents check2" );
+});
test("show()", function() {
expect(1);
@@ -430,6 +439,7 @@ test("removeClass(String) - add three classes and remove again", function() {
});
test("toggleClass(String)", function() {
+ expect(3);
var e = $("#firstp");
ok( !e.is(".test"), "Assert class not present" );
e.toggleClass("test");
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 4fb7f8e75..ee65edbb1 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1817,7 +1817,7 @@ new function() {
*/
jQuery.each({
parent: "a.parentNode",
- parents: jQuery.parents,
+ parents: "jQuery.parents(a)",
next: "jQuery.nth(a,1,'nextSibling')",
prev: "jQuery.nth(a,1,'previousSibling')",
siblings: "jQuery.sibling(a.parentNode.firstChild,a)",