Added a test case for bug #986.
[jquery.git] / src / selector / selectorTest.js
index 945455c..be216f8 100644 (file)
@@ -11,17 +11,21 @@ test("expressions - element", function() {
 });\r
 \r
 test("expressions - id", function() {\r
-       expect(8);\r
+       expect(11);\r
        t( "ID Selector", "#body", ["body"] );\r
        t( "ID Selector w/ Element", "body#body", ["body"] );\r
        t( "ID Selector w/ Element", "ul#first", [] );\r
+       t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );\r
+       t( "ID selector with non-existant descendant", "#firstp #foobar", [] );\r
        \r
        t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] );  // bug #267\r
        t( "ID Selector, not an ancestor ID", "#form  #first", [] );\r
        t( "ID Selector, not a child ID", "#form > #option1a", [] );\r
        \r
-       t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"]  );\r
-       t( "All Children of ID with no children", "#firstUL/*", []  );\r
+       t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );\r
+       t( "All Children of ID with no children", "#firstUL/*", [] );\r
+       \r
+       t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] );\r
 });\r
 \r
 \r
@@ -124,7 +128,7 @@ test("expressions - pseudo (:) selctors", function() {
 });\r
 \r
 test("expressions - basic xpath", function() {\r
-       expect(14);\r
+       expect(15);\r
        ok( jQuery.find("//*").length >= 30, "All Elements (//*)" );\r
        t( "All Div Elements", "//div", ["main","foo"] );\r
        t( "Absolute Path", "/html/body", ["body"] );\r
@@ -139,4 +143,8 @@ test("expressions - basic xpath", function() {
        t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );\r
        t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );\r
        t( "Has Children", "//p[a]", ["firstp","ap","en","sap"] );\r
-});
\ No newline at end of file
+       \r
+       $("#foo").each(function() {\r
+               isSet( $("/p", this).get(), q("sndp", "en", "sap"), "Check XPath context" );\r
+       });\r
+});\r