Localisation updates from http://translatewiki.net.
[mediawiki.git] / tests / qunit / suites / resources / jquery / jquery.tabIndex.test.js
blob98ff55081c07c52ec021488324c071c1ca45d1ee
1 module( 'jquery.tabIndex', QUnit.newMwEnvironment() );
3 test( '-- Initial check', function() {
4         expect(2);
6         ok( $.fn.firstTabIndex, '$.fn.firstTabIndex defined' );
7         ok( $.fn.lastTabIndex, '$.fn.lastTabIndex defined' );
8 });
10 test( 'firstTabIndex', function() {
11         expect(2);
13         var testEnvironment =
14 '<form>' +
15         '<input tabindex="7" />' +
16         '<input tabindex="9" />' +
17         '<textarea tabindex="2">Foobar</textarea>' +
18         '<textarea tabindex="5">Foobar</textarea>' +
19 '</form>';
21         var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' );
22         strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
24         var $testB = $( '<div>' );
25         strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
26 });
28 test( 'lastTabIndex', function() {
29         expect(2);
31         var testEnvironment =
32 '<form>' +
33         '<input tabindex="7" />' +
34         '<input tabindex="9" />' +
35         '<textarea tabindex="2">Foobar</textarea>' +
36         '<textarea tabindex="5">Foobar</textarea>' +
37 '</form>';
39         var $testA = $( '<div>' ).html( testEnvironment ).appendTo( '#qunit-fixture' );
40         strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
42         var $testB = $( '<div>' );
43         strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );
44 });