X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fselector%2FselectorTest.js;h=4d25c6076e4fd611f9993d47f1e5f23bdefc26aa;hb=4e256bffa320f1fe87f6e4daf17bbb4ed29ae88a;hp=aded7cd2f002d0308e43d3231443fc71ab44d36d;hpb=e0c7e6aec4cf55854217d5c0b2c7069ce84a3d12;p=jquery.git diff --git a/src/selector/selectorTest.js b/src/selector/selectorTest.js index aded7cd..4d25c60 100644 --- a/src/selector/selectorTest.js +++ b/src/selector/selectorTest.js @@ -1,28 +1,30 @@ module("selector"); test("expressions - element", function() { - expect(7); + expect(6); ok( $("*").size() >= 30, "Select all" ); t( "Element Selector", "div", ["main","foo"] ); t( "Element Selector", "body", ["body"] ); t( "Element Selector", "html", ["html"] ); t( "Parent Element", "div div", ["foo"] ); - t( "Object/Param element", "#object1 param", ["param1", "param2"] ); - ok( $("param", $("#object1")[0]).length == 2, "Object/param as context" ); + ok( $("param", "#object1").length == 2, "Object/param as context" ); }); test("expressions - id", function() { - expect(8); + expect(10); 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-existing 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/*", [] ); + }); @@ -125,7 +127,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"] ); @@ -140,4 +142,8 @@ test("expressions - basic xpath", function() { 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( "Has Children", "//p[a]", ["firstp","ap","en","sap"] ); + + $("#foo").each(function() { + isSet( $("/p", this).get(), q("sndp", "en", "sap"), "Check XPath context" ); + }); }); \ No newline at end of file