module("selector");\r
\r
test("expressions - element", function() {\r
- expect(7);\r
+ expect(6);\r
ok( $("*").size() >= 30, "Select all" );\r
t( "Element Selector", "div", ["main","foo"] );\r
t( "Element Selector", "body", ["body"] );\r
t( "Element Selector", "html", ["html"] );\r
t( "Parent Element", "div div", ["foo"] );\r
- t( "Object/Param element", "#object param", ["param1", "param2"] );\r
- ok( $("param", $("#object")[0]).length == 2, "Object/param as context" );\r
+ ok( $("param", "#object1").length == 2, "Object/param as context" );\r
});\r
\r
test("expressions - id", function() {\r
- expect(8);\r
+ expect(13);\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
+ $('<a name="tName1">tName1 A</a><a name="tName2">tName2 A</a><div id="tName1">tName1 Div</div>').appendTo('#main');\r
+ ok( $("#tName1")[0].id == 'tName1', "ID selector with same value for a name attribute" );\r
+ ok( $("#tName2").length == 0, "ID selector non-existing but name attribute on an A tag" );\r
+ \r
+ t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986\r
});\r
\r
\r
});\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
t( "Attribute Exists", "//a[@title]", ["google"] );\r
t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );\r
t( "Parent Axis", "//p/..", ["main","foo"] );\r
- 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( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","sndp","en","sap"] );\r
+ t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","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