Merge "resourceloader: Simplify StringSet fallback"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.tabIndex.test.js
1 ( function () {
2 QUnit.module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
3
4 QUnit.test( 'firstTabIndex', 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>';
12
13 $testA = $( '<div>' ).html( html ).appendTo( '#qunit-fixture' );
14 assert.strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
15
16 $testB = $( '<div>' );
17 assert.strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
18 } );
19
20 QUnit.test( 'lastTabIndex', 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>';
28
29 $testA = $( '<div>' ).html( html ).appendTo( '#qunit-fixture' );
30 assert.strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
31
32 $testB = $( '<div>' );
33 assert.strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );
34 } );
35 }() );