Renaming qunit test files to end in ".test.js" (finally!)
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.tabIndex.test.js
1 module( 'jquery.tabIndex' );
2
3 test( '-- Initial check', function() {
4 expect(2);
5
6 ok( $.fn.firstTabIndex, '$.fn.firstTabIndex defined' );
7 ok( $.fn.lastTabIndex, '$.fn.lastTabIndex defined' );
8 });
9
10 test( 'firstTabIndex', function() {
11 expect(2);
12
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>';
20
21 var $testA = $( '<div>' ).html( testEnvironment ).appendTo( 'body' );
22 strictEqual( $testA.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
23
24 var $testB = $( '<div>' );
25 strictEqual( $testB.firstTabIndex(), null, 'Return null if none available.' );
26
27 // Clean up
28 $testA.add( $testB ).remove();
29 });
30
31 test( 'lastTabIndex', function() {
32 expect(2);
33
34 var testEnvironment =
35 '<form>' +
36 '<input tabindex="7" />' +
37 '<input tabindex="9" />' +
38 '<textarea tabindex="2">Foobar</textarea>' +
39 '<textarea tabindex="5">Foobar</textarea>' +
40 '</form>';
41
42 var $testA = $( '<div>' ).html( testEnvironment ).appendTo( 'body' );
43 strictEqual( $testA.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
44
45 var $testB = $( '<div>' );
46 strictEqual( $testB.lastTabIndex(), null, 'Return null if none available.' );
47
48 // Clean up
49 $testA.add( $testB ).remove();
50 });