1 module( 'jquery.tabIndex' );
3 test( '-- Initial check', function() {
6 ok( $.fn
.firstTabIndex
, '$.fn.firstTabIndex defined' );
7 ok( $.fn
.lastTabIndex
, '$.fn.lastTabIndex defined' );
10 test( 'firstTabIndex', function() {
15 '<input tabindex="7" />' +
16 '<input tabindex="9" />' +
17 '<textarea tabindex="2">Foobar</textarea>' +
18 '<textarea tabindex="5">Foobar</textarea>' +
21 var $testA
= $( '<div>' ).html( testEnvironment
).appendTo( 'body' );
22 strictEqual( $testA
.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
24 var $testB
= $( '<div>' );
25 strictEqual( $testB
.firstTabIndex(), null, 'Return null if none available.' );
28 $testA
.add( $testB
).remove();
31 test( 'lastTabIndex', function() {
36 '<input tabindex="7" />' +
37 '<input tabindex="9" />' +
38 '<textarea tabindex="2">Foobar</textarea>' +
39 '<textarea tabindex="5">Foobar</textarea>' +
42 var $testA
= $( '<div>' ).html( testEnvironment
).appendTo( 'body' );
43 strictEqual( $testA
.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
45 var $testB
= $( '<div>' );
46 strictEqual( $testB
.lastTabIndex(), null, 'Return null if none available.' );
49 $testA
.add( $testB
).remove();