From 9a96af1d59cc6a10b89b6f2489b04871a9c1c7fa Mon Sep 17 00:00:00 2001 From: gnarf Date: Tue, 14 Jun 2011 23:38:36 -0500 Subject: Quick improvement to the performace of .index() with no arguments - Adding a unit test for .index() of a node without a parent returns -1 --- test/unit/traversing.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/unit') diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 5216ae752..70c142597 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -99,9 +99,11 @@ test("is(jQuery)", function() { }); test("index()", function() { - expect(1); + expect( 2 ); - equals( jQuery("#text2").index(), 2, "Returns the index of a child amongst its siblings" ) + equal( jQuery("#text2").index(), 2, "Returns the index of a child amongst its siblings" ); + + equal( jQuery("
").index(), -1, "Node without parent returns -1" ); }); test("index(Object|String|undefined)", function() { -- cgit v1.2.3