2 QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
4 QUnit.test( 'firstTabIndex', 2, function ( assert ) {
5 var html, $testA, $testB;
7 '<input tabindex="7" />' +
8 '<input tabindex="9" />' +
9 '<textarea tabindex="2">Foobar</textarea>' +
10 '<textarea tabindex="5">Foobar</textarea>' +
13 $testA = $( '<div>' ).html( html ).appendTo( '#qunit-fixture' );
14 assert.strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
16 $testB = $( '<div>' );
17 assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
20 QUnit.test( 'lastTabIndex', 2, function ( assert ) {
21 var html, $testA, $testB;
23 '<input tabindex="7" />' +
24 '<input tabindex="9" />' +
25 '<textarea tabindex="2">Foobar</textarea>' +
26 '<textarea tabindex="5">Foobar</textarea>' +
29 $testA = $( '<div>' ).html( html ).appendTo( '#qunit-fixture' );
30 assert.strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
32 $testB = $( '<div>' );
33 assert.strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );