aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-17 13:23:39 -0500
committerjeresig <jeresig@gmail.com>2009-12-17 13:23:39 -0500
commit3a4bcf8a9ca6d3a986858d2572b356176ae06012 (patch)
tree61eb3b2ae7bd7678d0f361d106608ae99abd1e08 /test
parent892fb555477dc96f58e3f8fd5446f7990188fc21 (diff)
downloadjquery-3a4bcf8a9ca6d3a986858d2572b356176ae06012.tar.gz
jquery-3a4bcf8a9ca6d3a986858d2572b356176ae06012.zip
Added some more tests around the name tests to catch possible regressions.
Diffstat (limited to 'test')
-rw-r--r--test/unit/selector.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 0a5d0bbff..b8fab0824 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -148,7 +148,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 +163,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('<a id="tName1ID" name="tName1">tName1 A</a><a id="tName2ID" name="tName2">tName2 A</a><div id="tName1">tName1 Div</div>').appendTo('#main');
+ var a = jQuery('<div><a id="tName1ID" name="tName1">tName1 A</a><a id="tName2ID" name="tName2">tName2 A</a><div id="tName1">tName1 Div</div></div>').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();
});