Cleaned up a lot of the test suite - reorganized and renamed tests. Added a new trigg...
[jquery.git] / src / selector / selectorTest.js
index 9180743..8200595 100644 (file)
@@ -1,13 +1,16 @@
 module("selector");
 
 test("element", function() {
-       expect(6);
+       expect(8);
        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"] );
        ok( $("param", "#object1").length == 2, "Object/param as context" );
+       
+       ok( $("#length").length, '<input name="length"> cannot be found under IE, see #945' );
+       ok( $("#lengthtest input").length, '<input name="length"> cannot be found under IE, see #945' );
 });
 
 test("broken", function() {
@@ -85,7 +88,7 @@ test("multiple", function() {
 });
 
 test("child and adjacent", function() {
-       expect(14);
+       expect(22);
        t( "Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"] );
        t( "Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"] );
        t( "Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"] );
@@ -99,7 +102,18 @@ test("child and adjacent", function() {
        t( "Adjacent", "a+a", ["groups"] );
        t( "Adjacent", "p + p", ["ap","en","sap"] );
        t( "Comma, Child, and Adjacent", "a + a, code > a", ["groups","anchor1","anchor2"] );
+       
        t( "First Child", "p:first-child", ["firstp","sndp"] );
+       t( "Nth Child", "p:nth-child(1)", ["firstp","sndp"] );
+       t( "First Child, XPath", "p[1]", ["firstp","sndp"] );
+       
+       t( "Last Child", "p:last-child", ["sap"] );
+       t( "Last Child, XPath", "p[3]", ["sap"] );
+       
+       t( "Nth-child", "#main form > *:nth-child(2)", ["text2"] );
+       t( "Nth-child, XPath", "#main form > *[2]", ["text2"] );
+       t( "Nth-child", "#main form > :nth-child(2)", ["text2"] );
+       t( "Nth-child, XPath", "#main form > [2]", ["text2"] );
 });
 
 test("attributes", function() {
@@ -132,7 +146,7 @@ test("attributes", function() {
        t( ":not() Equals quoted attribute", "select:not([@name='select1'])", ["select2", "select3"]);
 });
 
-test("pseudo (:) selctors", function() {
+test("pseudo (:) selectors", function() {
        expect(30);
        t( "First Child", "p:first-child", ["firstp","sndp"] );
        t( "Last Child", "p:last-child", ["sap"] );
@@ -188,4 +202,4 @@ test("basic xpath", function() {
        $("#foo").each(function() {
                isSet( $("/p", this).get(), q("sndp", "en", "sap"), "Check XPath context" );
        });
-});
+});
\ No newline at end of file