aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/traversing.js
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2011-10-30 13:13:26 -0400
committerDave Methvin <dave.methvin@gmail.com>2011-11-06 16:17:59 -0500
commit7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a (patch)
treed48040d3e60b9de641c72820206d93fefb755dd3 /test/unit/traversing.js
parente086c22826e681bb8afcff93c16c8ad41389a096 (diff)
downloadjquery-7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a.tar.gz
jquery-7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a.zip
Coerce eq() argument all the time. Fixes #10616
Diffstat (limited to 'test/unit/traversing.js')
-rw-r--r--test/unit/traversing.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index d276a0d6f..bcd3a974e 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -103,9 +103,9 @@ test("is(jQuery)", function() {
test("is() with positional selectors", function() {
expect(23);
-
- var html = jQuery(
- '<p id="posp"><a class="firsta" href="#"><em>first</em></a><a class="seconda" href="#"><b>test</b></a><em></em></p>'
+
+ var html = jQuery(
+ '<p id="posp"><a class="firsta" href="#"><em>first</em></a><a class="seconda" href="#"><b>test</b></a><em></em></p>'
).appendTo( "body" ),
isit = function(sel, match, expect) {
equal( jQuery( sel ).is( match ), expect, "jQuery( " + sel + " ).is( " + match + " )" );
@@ -630,3 +630,13 @@ test("add(String, Context)", function() {
deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", ctx ).get(), q( "firstp" ), "Add gEBId to selector, not in context" );
deepEqual( jQuery( document.getElementById("firstp") ).add( "#ap", document.getElementsByTagName("body")[0] ).get(), q( "firstp", "ap" ), "Add gEBId to selector, in context" );
});
+
+test("eq('-1') #10616", function() {
+ expect(3);
+ var $divs = jQuery( "div" );
+
+ equal( $divs.eq( -1 ).length, 1, "The number -1 returns a selection that has length 1" );
+ equal( $divs.eq( "-1" ).length, 1, "The string '-1' returns a selection that has length 1" );
+ deepEqual( $divs.eq( "-1" ), $divs.eq( -1 ), "String and number -1 match" );
+});
+