1 module( 'jquery.tabIndex.js' );
3 test( '-- Initial check', function(){
6 ok( $.fn.firstTabIndex, '$.fn.firstTabIndex defined' );
7 ok( $.fn.lastTabIndex, '$.fn.lastTabIndex defined' );
11 test( 'firstTabIndex', function(){
16 '<input tabindex="7" />' +
17 '<input tabindex="9" />' +
18 '<textarea tabindex="2">Foobar</textarea>' +
19 '<textarea tabindex="5">Foobar</textarea>' +
21 var $testA = $( '<div />' ).html( testEnvironment ).appendTo( 'body' );
23 deepEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
25 var $testB = $( '<div />' );
27 deepEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
30 $testA.add( $testB).remove();
33 test( 'lastTabIndex', function(){
38 '<input tabindex="7" />' +
39 '<input tabindex="9" />' +
40 '<textarea tabindex="2">Foobar</textarea>' +
41 '<textarea tabindex="5">Foobar</textarea>' +
43 var $testA = $( '<div />' ).html( testEnvironment ).appendTo( 'body' );
45 deepEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
47 var $testB = $( '<div />' );
49 deepEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );
52 $testA.add( $testB).remove();