X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fselector.js;h=9f29bf6bfa4cd9d35f41871e855d7f1785a43de9;hb=8533da939d933561aa6c516db4e544dba076a988;hp=72511eb662b7e282f661581301ad67b66af40656;hpb=20827707a94c8569bcc422f71bf5b37bc55695df;p=jquery.git
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 72511eb..9f29bf6 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -69,7 +69,7 @@ test("broken", function() {
});
test("id", function() {
- expect(27);
+ expect(28);
t( "ID Selector", "#body", ["body"] );
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
@@ -105,6 +105,8 @@ test("id", function() {
t( "Underscore ID", "#types_all", ["types_all"] );
t( "Dash ID", "#fx-queue", ["fx-queue"] );
+
+ t( "ID with weird characters in it", "#name\\+value", ["name+value"] );
});
test("class", function() {
@@ -144,7 +146,7 @@ test("class", function() {
});
test("name", function() {
- expect(9);
+ expect(11);
t( "Name selector", "input[name=action]", ["text1"] );
t( "Name selector with single quotes", "input[name='action']", ["text1"] );
@@ -158,6 +160,13 @@ test("name", function() {
isSet( jQuery("#form").find("input[name=action]"), q("text1"), "Name selector within the context of another element" );
isSet( jQuery("#form").find("input[name='foo[bar]']"), q("hidden2"), "Name selector for grouped form element within the context of another element" );
+
+ var a = jQuery('tName1 AtName2 A
tName1 Div
').appendTo('#main');
+
+ t( "Find elements that have similar IDs", "[name=tName1]", ["tName1ID"] );
+ t( "Find elements that have similar IDs", "[name=tName2]", ["tName2ID"] );
+
+ a.remove();
});
@@ -171,7 +180,7 @@ test("multiple", function() {
});
test("child and adjacent", function() {
- expect(45);
+ 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"] );
@@ -184,6 +193,9 @@ test("child and adjacent", function() {
t( "Adjacent", "a+ a", ["groups"] );
t( "Adjacent", "a+a", ["groups"] );
t( "Adjacent", "p + p", ["ap","en","sap"] );
+ t( "Adjacent", "p#firstp + p", ["ap"] );
+ t( "Adjacent", "p[lang=en] + p", ["sap"] );
+ t( "Adjacent", "a.GROUPS + code + a", ["mark"] );
t( "Comma, Child, and Adjacent", "a + a, code > a", ["groups","anchor1","anchor2"] );
t( "Verify deep class selector", "div.blah > p > a", [] );
@@ -199,6 +211,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("");
@@ -296,7 +309,7 @@ test("attributes", function() {
});
test("pseudo (:) selectors", function() {
- expect(67);
+ expect(70);
t( "First Child", "p:first-child", ["firstp","sndp"] );
t( "Last Child", "p:last-child", ["sap"] );
t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"] );
@@ -342,8 +355,11 @@ test("pseudo (:) selectors", function() {
t( "Position Greater Than", "p:gt(0)", ["ap","sndp","en","sap","first"] );
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", ["text1","text2","radio1","radio2","check1","check2","name"] );
- t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
+ t( "Is Visible", "#form input:visible", [] );
+ t( "Is Visible", "div:visible:not(.testrunner-toolbar)", ["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"] );
t( "Check position filtering", "div#nothiddendiv:eq(0)", ["nothiddendiv"] );
t( "Check position filtering", "div#nothiddendiv:last", ["nothiddendiv"] );