Merge "Use WebRequest instead of $_SERVER in ApiMain."
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.tabIndex.test.js
1 QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
2
3 QUnit.test( 'firstTabIndex', 2, function ( assert ) {
4 var testEnvironment =
5 '<form>' +
6 '<input tabindex="7" />' +
7 '<input tabindex="9" />' +
8 '<textarea tabindex="2">Foobar</textarea>' +
9 '<textarea tabindex="5">Foobar</textarea>' +
10 '</form>';
11
12 var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' );
13 assert.strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
14
15 var $testB = $( '<div>' );
16 assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
17 });
18
19 QUnit.test( 'lastTabIndex', 2, function ( assert ) {
20 var testEnvironment =
21 '<form>' +
22 '<input tabindex="7" />' +
23 '<input tabindex="9" />' +
24 '<textarea tabindex="2">Foobar</textarea>' +
25 '<textarea tabindex="5">Foobar</textarea>' +
26 '</form>';
27
28 var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' );
29 assert.strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
30
31 var $testB = $( '<div>' );
32 assert.strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );
33 });