Adding test suite for jquery.tabIndex.js, currently broken per:
authorKrinkle <krinkle@users.mediawiki.org>
Sun, 22 May 2011 23:36:17 +0000 (23:36 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Sun, 22 May 2011 23:36:17 +0000 (23:36 +0000)
(bug 29048) jQuery.tabIndex: firstTabIndex() outputs the same as lastTabIndex()

tests/qunit/index.html
tests/qunit/suites/resources/jquery/jquery.tabIndex.js [new file with mode: 0644]

index c610e57..a59cda5 100644 (file)
@@ -33,8 +33,9 @@
        </script>
 
        <!-- MW: Non-default modules -->
-       <script src="../../resources/jquery/jquery.colorUtil.js"></script>
        <script src="../../resources/jquery/jquery.autoEllipsis.js"></script>
+       <script src="../../resources/jquery/jquery.colorUtil.js"></script>
+       <script src="../../resources/jquery/jquery.tabIndex.js"></script>
 
        <!-- QUnit: Load framework -->
        <link rel="stylesheet" href="../../resources/jquery/jquery.qunit.css" />
@@ -45,8 +46,8 @@
        <script src="suites/resources/mediawiki/mediawiki.user.js"></script>
        <script src="suites/resources/jquery/jquery.mwPrototypes.js"></script>
        <script src="suites/resources/mediawiki.util/mediawiki.util.js"></script>
-       <script src="suites/resources/jquery/jquery.colorUtil.js"></script>
        <script src="suites/resources/jquery/jquery.autoEllipsis.js"></script>
+       <script src="suites/resources/jquery/jquery.tabIndex.js"></script>
 
        <!-- TestSwarm: If a test swarm is running this,
             the following script will allow it to extract the results.
diff --git a/tests/qunit/suites/resources/jquery/jquery.tabIndex.js b/tests/qunit/suites/resources/jquery/jquery.tabIndex.js
new file mode 100644 (file)
index 0000000..32862cd
--- /dev/null
@@ -0,0 +1,40 @@
+module( 'jquery.tabIndex.js' );
+
+test( '-- Initial check', function(){
+
+       ok( $.fn.firstTabIndex, '$.fn.firstTabIndex defined' );
+       ok( $.fn.lastTabIndex, '$.fn.lastTabIndex defined' );
+
+});
+
+test( 'firstTabIndex', function(){
+
+       var testEnvironment = 
+'<form>\
+       <input tabindex="7" />\
+       <input tabindex="2" />\
+       <textarea tabindex="9">Foobar</textarea>\
+</form>';
+       var $test = $( '<div />' ).html( testEnvironment ).appendTo( 'body' );
+
+       deepEqual( $test.firstTabIndex(), 2, 'First tabindex should be 2 within this context.' );
+
+       // Clean up
+       $test.remove();
+});
+
+test( 'lastTabIndex', function(){
+
+       var testEnvironment = 
+'<form>\
+       <input tabindex="7" />\
+       <input tabindex="2" />\
+       <textarea tabindex="9">Foobar</textarea>\
+</form>';
+       var $test = $( '<div />' ).html( testEnvironment ).appendTo( 'body' );
+
+       deepEqual( $test.lastTabIndex(), 9, 'Last tabindex should be 9 within this context.' );
+
+       // Clean up
+       $test.remove();
+});
\ No newline at end of file