( function ( $ ) { QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() ); QUnit.test( 'firstTabIndex', 2, function ( assert ) { var html, $testA, $testB; html = '
' + '' + '' + '' + '' + '
'; $testA = $( '
' ).html( html ).appendTo( '#qunit-fixture' ); assert.strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' ); $testB = $( '
' ); assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' ); } ); QUnit.test( 'lastTabIndex', 2, function ( assert ) { var html, $testA, $testB; html = '
' + '' + '' + '' + '' + '
'; $testA = $( '
' ).html( html ).appendTo( '#qunit-fixture' ); assert.strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' ); $testB = $( '
' ); assert.strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' ); } ); }( jQuery ) );