X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=inline;f=test%2Funit%2Fselector.js;h=065b1d76377d7f79c520a81ea7d2da4016b563bd;hb=ba86cc0294e483752fd76f620aba6d0a4a7a8ee1;hp=233d11a4be9287166ec07f66baa84e22a8e9c60b;hpb=9d6c4d8413e678203a905ab3bc3a87415a6a70ce;p=jquery.git
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 233d11a..065b1d7 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -96,9 +96,11 @@ test("id", function() {
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
t( "All Children of ID with no children", "#firstUL > *", [] );
- jQuery('tName1 AtName2 A
tName1 Div
').appendTo('#main');
+ var a = jQuery('').appendTo('#main');
equals( jQuery("#tName1")[0].id, 'tName1', "ID selector with same value for a name attribute" );
equals( jQuery("#tName2").length, 0, "ID selector non-existing but name attribute on an A tag" );
+ a.remove();
+
t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
@@ -148,7 +150,7 @@ test("class", function() {
});
test("name", function() {
- expect(11);
+ expect(14);
t( "Name selector", "input[name=action]", ["text1"] );
t( "Name selector with single quotes", "input[name='action']", ["text1"] );
@@ -163,10 +165,14 @@ test("name", function() {
same( jQuery("#form").find("input[name=action]").get(), q("text1"), "Name selector within the context of another element" );
same( jQuery("#form").find("input[name='foo[bar]']").get(), q("hidden2"), "Name selector for grouped form element within the context of another element" );
- var a = jQuery('tName1 AtName2 AtName1 Div
').appendTo('#main');
+ var a = jQuery('').appendTo('#main').children();
+
+ equals( a.length, 3, "Make sure the right number of elements were inserted." );
+ equals( a[1].id, "tName2ID", "Make sure the right number of elements were inserted." );
t( "Find elements that have similar IDs", "[name=tName1]", ["tName1ID"] );
t( "Find elements that have similar IDs", "[name=tName2]", ["tName2ID"] );
+ t( "Find elements that have similar IDs", "#tName2ID", ["tName2ID"] );
a.remove();
});
@@ -379,6 +385,7 @@ test("pseudo - position", function() {
t( "Check element position", "div#nothiddendiv:first > div:first", ["nothiddendivchild"] );
});
+if ( (window.Sizzle || jQuery.find).selectors.filters.visibility ) {
test("pseudo - visibility", function() {
expect(11);
@@ -401,6 +408,7 @@ test("pseudo - visibility", function() {
t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
$div.remove();
});
+}
test("pseudo - form", function() {
expect(8);