Merge "Define 'MW_UPDATER' when running update.php"
[mediawiki.git] / tests / qunit / suites / resources / jquery / jquery.tabIndex.test.js
blob121379315ba87bb71bb89d355649faf2a3e2a535
1 ( function ( $ ) {
2         QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
4         QUnit.test( 'firstTabIndex', 2, function ( assert ) {
5                 var html, $testA, $testB;
6                 html = '<form>' +
7                         '<input tabindex="7" />' +
8                         '<input tabindex="9" />' +
9                         '<textarea tabindex="2">Foobar</textarea>' +
10                         '<textarea tabindex="5">Foobar</textarea>' +
11                         '</form>';
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.' );
18         } );
20         QUnit.test( 'lastTabIndex', 2, function ( assert ) {
21                 var html, $testA, $testB;
22                 html = '<form>' +
23                         '<input tabindex="7" />' +
24                         '<input tabindex="9" />' +
25                         '<textarea tabindex="2">Foobar</textarea>' +
26                         '<textarea tabindex="5">Foobar</textarea>' +
27                         '</form>';
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.' );
34         } );
35 }( jQuery ) );