2 QUnit
.module( 'jquery.tabIndex', QUnit
.newMwEnvironment() );
4 QUnit
.test( 'firstTabIndex', 2, function ( assert
) {
5 var html
, $testA
, $testB
;
8 '<input tabindex="7" />' +
9 '<input tabindex="9" />' +
10 '<textarea tabindex="2">Foobar</textarea>' +
11 '<textarea tabindex="5">Foobar</textarea>' +
14 $testA
= $( '<div>' ).html( html
).appendTo( '#qunit-fixture' );
15 assert
.strictEqual( $testA
.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
17 $testB
= $( '<div>' );
18 assert
.strictEqual( $testB
.firstTabIndex(), null, 'Return null if none available.' );
21 QUnit
.test( 'lastTabIndex', 2, function ( assert
) {
22 var html
, $testA
, $testB
;
25 '<input tabindex="7" />' +
26 '<input tabindex="9" />' +
27 '<textarea tabindex="2">Foobar</textarea>' +
28 '<textarea tabindex="5">Foobar</textarea>' +
31 $testA
= $( '<div>' ).html( html
).appendTo( '#qunit-fixture' );
32 assert
.strictEqual( $testA
.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
34 $testB
= $( '<div>' );
35 assert
.strictEqual( $testB
.lastTabIndex(), null, 'Return null if none available.' );