X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fselector%2FselectorTest.js;h=fea247ea3642858ea1cbfa91a8210d0f1eef8c9f;hb=0f7c89cd97de6ca644a834a119dda1e057fd724e;hp=945455ce36f40b3baa65e7445f013cac4a40b441;hpb=955fdb87a72e0d85676db932eda9f6a4319306d9;p=jquery.git
diff --git a/src/selector/selectorTest.js b/src/selector/selectorTest.js
index 945455c..fea247e 100644
--- a/src/selector/selectorTest.js
+++ b/src/selector/selectorTest.js
@@ -11,17 +11,25 @@ test("expressions - element", function() {
});
test("expressions - id", function() {
- expect(8);
+ expect(13);
t( "ID Selector", "#body", ["body"] );
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
+ t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );
+ t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
t( "ID Selector, not an ancestor ID", "#form #first", [] );
t( "ID Selector, not a child ID", "#form > #option1a", [] );
- t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );
- t( "All Children of ID with no children", "#firstUL/*", [] );
+ t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );
+ t( "All Children of ID with no children", "#firstUL/*", [] );
+
+ $('tName1 AtName2 A
tName1 Div
').appendTo('#main');
+ ok( $("#tName1")[0].id == 'tName1', "ID selector with same value for a name attribute" );
+ ok( $("#tName2").length == 0, "ID selector non-existing but name attribute on an A tag" );
+
+ t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
});
@@ -124,7 +132,7 @@ test("expressions - pseudo (:) selctors", function() {
});
test("expressions - basic xpath", function() {
- expect(14);
+ expect(15);
ok( jQuery.find("//*").length >= 30, "All Elements (//*)" );
t( "All Div Elements", "//div", ["main","foo"] );
t( "Absolute Path", "/html/body", ["body"] );
@@ -136,7 +144,11 @@ test("expressions - basic xpath", function() {
t( "Attribute Exists", "//a[@title]", ["google"] );
t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );
t( "Parent Axis", "//p/..", ["main","foo"] );
- t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
- t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","sndp","en","sap"] );
+ t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","sndp","en","sap"] );
+ t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","sndp","en","sap"] );
t( "Has Children", "//p[a]", ["firstp","ap","en","sap"] );
-});
\ No newline at end of file
+
+ $("#foo").each(function() {
+ isSet( $("/p", this).get(), q("sndp", "en", "sap"), "Check XPath context" );
+ });
+});