test runner: optimizing a test for speed.
authorAriel Flesler <aflesler@gmail.com>
Tue, 1 Jul 2008 02:08:45 +0000 (02:08 +0000)
committerAriel Flesler <aflesler@gmail.com>
Tue, 1 Jul 2008 02:08:45 +0000 (02:08 +0000)
test/unit/core.js

index dbf23e7..71b1246 100644 (file)
@@ -1576,14 +1576,17 @@ test("empty()", function() {
 \r
 test("slice()", function() {\r
        expect(6);\r
-       isSet( jQuery("#ap a").slice(1,2), q("groups"), "slice(1,2)" );\r
-       isSet( jQuery("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" );\r
-       isSet( jQuery("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );\r
-       isSet( jQuery("#ap a").slice(-1), q("mark"), "slice(-1)" );\r
+       \r
+       var $links = jQuery("#ap a");\r
+       \r
+       isSet( $links.slice(1,2), q("groups"), "slice(1,2)" );\r
+       isSet( $links.slice(1), q("groups", "anchor1", "mark"), "slice(1)" );\r
+       isSet( $links.slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" );\r
+       isSet( $links.slice(-1), q("mark"), "slice(-1)" );\r
 \r
-       isSet( jQuery("#ap a").eq(1), q("groups"), "eq(1)" );\r
+       isSet( $links.eq(1), q("groups"), "eq(1)" );\r
        \r
-       isSet( jQuery("#ap a").eq('1'), q("groups"), "eq('1')" );\r
+       isSet( $links.eq('2'), q("anchor1"), "eq('2')" );\r
 });\r
 \r
 test("map()", function() {\r