From afaf4e39db993b6b03650732fe58f1a79c913bd2 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Sun, 22 May 2011 23:52:16 +0000 Subject: [PATCH] jquery.tabIndex.js was broken, not it works (for the first time?) * Defaulting to null * Setting to initial value during first iteration (instead of outside the loop), that way we dont have to set minTabIndex to some insane high value to let if ( .. > .. ) work * (bug 29048) jQuery.tabIndex: firstTabIndex() outputs the same as lastTabIndex() * Added extra \ + \ + \ + \ '; - var $test = $( '
' ).html( testEnvironment ).appendTo( 'body' ); + var $testA = $( '
' ).html( testEnvironment ).appendTo( 'body' ); - deepEqual( $test.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' ); + deepEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' ); + + var $testB = $( '
' ); + + deepEqual( $testB.firstTabIndex(), null, 'Return null if none available.' ); // Clean up - $test.remove(); + $testA.add( $testB).remove(); }); test( 'lastTabIndex', function(){ @@ -28,13 +33,18 @@ test( 'lastTabIndex', function(){ var testEnvironment = '
\ \ - \ - \ + \ + \ + \
'; - var $test = $( '
' ).html( testEnvironment ).appendTo( 'body' ); + var $testA = $( '
' ).html( testEnvironment ).appendTo( 'body' ); + + deepEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' ); + + var $testB = $( '
' ); - deepEqual( $test.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' ); + deepEqual( $testB.lastTabIndex(), null, 'Return null if none available.' ); // Clean up - $test.remove(); + $testA.add( $testB).remove(); }); \ No newline at end of file -- 2.20.1