Skip to content

Commit f9a7cfa

Browse files
committed
Updated the copy of jQuery and added some more context tests.
1 parent 87b3ea4 commit f9a7cfa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/unit/selector.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module("selector");
22

33
test("element", function() {
4-
expect(14);
4+
expect(18);
55
reset();
66

77
ok( jQuery("*").size() >= 30, "Select all" );
@@ -15,6 +15,11 @@ test("element", function() {
1515
t( "Element Selector", "html", ["html"] );
1616
t( "Parent Element", "div p", ["firstp","ap","sndp","en","sap","first"] );
1717
equals( jQuery("param", "#object1").length, 2, "Object/param as context" );
18+
19+
isSet( jQuery("p", document.getElementsByTagName("div")), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
20+
isSet( jQuery("p", "div"), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
21+
isSet( jQuery("p", jQuery("div")), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
22+
isSet( jQuery("div").find("p"), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
1823

1924
ok( jQuery("#length").length, '<input name="length"> cannot be found under IE, see #945' );
2025
ok( jQuery("#lengthtest input").length, '<input name="length"> cannot be found under IE, see #945' );
@@ -103,12 +108,17 @@ test("id", function() {
103108
});
104109

105110
test("class", function() {
106-
expect(18);
111+
expect(22);
107112
t( "Class Selector", ".blog", ["mark","simon"] );
108113
t( "Class Selector", ".GROUPS", ["groups"] );
109114
t( "Class Selector", ".blog.link", ["simon"] );
110115
t( "Class Selector w/ Element", "a.blog", ["mark","simon"] );
111116
t( "Parent Class Selector", "p .blog", ["mark","simon"] );
117+
118+
isSet( jQuery(".blog", document.getElementsByTagName("p")), q("mark", "simon"), "Finding elements with a context." );
119+
isSet( jQuery(".blog", "p"), q("mark", "simon"), "Finding elements with a context." );
120+
isSet( jQuery(".blog", jQuery("p")), q("mark", "simon"), "Finding elements with a context." );
121+
isSet( jQuery("p").find(".blog"), q("mark", "simon"), "Finding elements with a context." );
112122

113123
t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] );
114124
//t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] );

0 commit comments

Comments
 (0)