Added test and fixed parents()
[jquery.git] / src / jquery / coreTest.js
index a189739..58616db 100644 (file)
@@ -388,6 +388,15 @@ test("children([String])", function() {
        isSet( $("#foo").children("[code]").get(), q("sndp", "sap"), "Check for filtered children" );\r
 });\r
 \r
+test("parent[s]([String])", function() {\r
+       ok( $("#groups").parent()[0].id == "ap", "Simple parent check" );\r
+       ok( $("#groups").parent("p")[0].id == "ap", "Filtered parent check" );\r
+       ok( $("#groups").parent("div").length == 0, "Filtered parent check, no match" );\r
+       \r
+       ok( $("#groups").parents()[0].id == "ap", "Simple parents check" );\r
+       ok( $("#groups").parents("p")[0].id == "ap", "Filtered parents check" );\r
+       ok( $("#groups").parents("div")[0].id == "main", "Filtered parents check2" );\r
+});\r
 \r
 test("show()", function() {\r
        expect(1);\r
@@ -429,6 +438,16 @@ test("removeClass(String) - add three classes and remove again", function() {
        ok( pass, "Remove multiple classes" );\r
 });\r
 \r
+test("toggleClass(String)", function() {\r
+       expect(3);\r
+       var e = $("#firstp");\r
+       ok( !e.is(".test"), "Assert class not present" );\r
+       e.toggleClass("test");\r
+       ok( e.is(".test"), "Assert class present" ); \r
+       e.toggleClass("test");\r
+       ok( !e.is(".test"), "Assert class not present" );\r
+});\r
+\r
 test("removeAttr(String", function() {\r
        ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );\r
 });\r