Added test and fixed parents()
This commit is contained in:
parent
aa424984f7
commit
ea283bd131
10
src/jquery/coreTest.js
vendored
10
src/jquery/coreTest.js
vendored
|
@ -388,6 +388,15 @@ test("children([String])", function() {
|
||||||
isSet( $("#foo").children("[code]").get(), q("sndp", "sap"), "Check for filtered children" );
|
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() {
|
test("show()", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
@ -430,6 +439,7 @@ test("removeClass(String) - add three classes and remove again", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("toggleClass(String)", function() {
|
test("toggleClass(String)", function() {
|
||||||
|
expect(3);
|
||||||
var e = $("#firstp");
|
var e = $("#firstp");
|
||||||
ok( !e.is(".test"), "Assert class not present" );
|
ok( !e.is(".test"), "Assert class not present" );
|
||||||
e.toggleClass("test");
|
e.toggleClass("test");
|
||||||
|
|
2
src/jquery/jquery.js
vendored
2
src/jquery/jquery.js
vendored
|
@ -1817,7 +1817,7 @@ new function() {
|
||||||
*/
|
*/
|
||||||
jQuery.each({
|
jQuery.each({
|
||||||
parent: "a.parentNode",
|
parent: "a.parentNode",
|
||||||
parents: jQuery.parents,
|
parents: "jQuery.parents(a)",
|
||||||
next: "jQuery.nth(a,1,'nextSibling')",
|
next: "jQuery.nth(a,1,'nextSibling')",
|
||||||
prev: "jQuery.nth(a,1,'previousSibling')",
|
prev: "jQuery.nth(a,1,'previousSibling')",
|
||||||
siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
|
siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
|
||||||
|
|
Loading…
Reference in a new issue