1 module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
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( '#qunit-fixture' );
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 test( 'lastTabIndex', function() {
33 '<input tabindex="7" />' +
34 '<input tabindex="9" />' +
35 '<textarea tabindex="2">Foobar</textarea>' +
36 '<textarea tabindex="5">Foobar</textarea>' +
39 var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' );
40 strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
42 var $testB = $( '<div>' );
43 strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );