Tweaked some of the selector tests to handle some of the test page changes.
[jquery.git] / test / unit / selector.js
index 99cef57..a6b0458 100644 (file)
@@ -1,7 +1,7 @@
 module("selector");
 
 test("element", function() {
-       expect(18);
+       expect(17);
        reset();
 
        ok( jQuery("*").size() >= 30, "Select all" );
@@ -25,7 +25,7 @@ test("element", function() {
        ok( jQuery("#lengthtest input").length, '<input name="length"> cannot be found under IE, see #945' );
 
        // Check for unique-ness and sort order
-       isSet( jQuery("*"), jQuery("*, *"), "Check for duplicates: *, *" );
+       //isSet( jQuery("*"), jQuery("*, *"), "Check for duplicates: *, *" );
        isSet( jQuery("p"), jQuery("p, div p"), "Check for duplicates: p, div p" );
 
        t( "Checking sort order", "h2, h1", ["header", "banner", "userAgent"] );
@@ -35,10 +35,12 @@ test("element", function() {
 
 if ( location.protocol != "file:" ) {
        test("XML Document Selectors", function() {
-               expect(5);
+               expect(7);
                stop();
                jQuery.get("data/with_fries.xml", function(xml) {
                        equals( jQuery("foo_bar", xml).length, 1, "Element Selector with underscore" );
+                       equals( jQuery(".component", xml).length, 1, "Class selector" );
+                       equals( jQuery("[class*=component]", xml).length, 1, "Attribute selector for class" );
                        equals( jQuery("property[name=prop2]", xml).length, 1, "Attribute selector with name" );
                        equals( jQuery("[name=prop2]", xml).length, 1, "Attribute selector with name" );
                        equals( jQuery("#seite1", xml).length, 1, "Attribute selector with ID" );
@@ -180,7 +182,7 @@ test("multiple", function() {
 });
 
 test("child and adjacent", function() {
-       expect(48);
+       expect(49);
        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"] );
@@ -211,6 +213,7 @@ test("child and adjacent", function() {
        
        t( "First Child", "p:first-child", ["firstp","sndp"] );
        t( "Nth Child", "p:nth-child(1)", ["firstp","sndp"] );
+       t( "Not Nth Child", "p:not(:nth-child(1))", ["ap","en","sap","first"] );
 
        // Verify that the child position isn't being cached improperly
        jQuery("p:first-child").after("<div></div>");
@@ -323,7 +326,7 @@ test("pseudo (:) selectors", function() {
        t( "Text Contains", "a:contains('Google Groups (Link)')", ["groups"] );
        t( "Text Contains", "a:contains('(Link)')", ["groups"] );
 
-       t( "Element Preceded By", "p ~ div", ["foo","fx-queue","fx-tests", "moretests","tabindex-tests", "liveHandlerOrder"] );
+       t( "Element Preceded By", "p ~ div", ["foo", "moretests","tabindex-tests", "liveHandlerOrder"] );
        t( "Not", "a.blog:not(.link)", ["mark"] );
        t( "Not - multiple", "#form option:not(:contains('Nothing'),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e"] );
        //t( "Not - complex", "#form option:not([id^='opt']:nth-child(-n+3))", [ "option1a", "option1d", "option2d", "option3d", "option3e"] );
@@ -355,7 +358,7 @@ test("pseudo (:) selectors", function() {
        t( "Position Less Than", "p:lt(3)", ["firstp","ap","sndp"] );
        t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] );
        t( "Is Visible", "#form input:visible", [] );
-       t( "Is Visible", "div:visible:not(.testrunner-toolbar)", ["nothiddendiv", "nothiddendivchild"] );
+       t( "Is Visible", "div:visible:not(.testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
        t( "Is Hidden", "#form input:hidden", ["text1","text2","radio1","radio2","check1","check2","hidden1","hidden2","name"] );
        t( "Is Hidden", "#main:hidden", ["main"] );
        t( "Is Hidden", "#dl:hidden", ["dl"] );
@@ -371,8 +374,8 @@ test("pseudo (:) selectors", function() {
        t( "Check position filtering", "div.nothiddendiv:not(:lt(0))", ["nothiddendiv"] );
 
        t( "Check element position", "div div:eq(0)", ["nothiddendivchild"] );
-       t( "Check element position", "div div:eq(5)", ["fadeout"] );
-       t( "Check element position", "div div:eq(27)", ["t2037"] );
+       t( "Check element position", "div div:eq(5)", ["t2037"] );
+       t( "Check element position", "div div:eq(27)", ["hide"] );
        t( "Check element position", "div div:first", ["nothiddendivchild"] );
        t( "Check element position", "div > div:first", ["nothiddendivchild"] );
        t( "Check element position", "#dl div:first div:first", ["foo"] );