From 3c3d81a185b55e470f29dcf20d8db1bbc0c8d5ae Mon Sep 17 00:00:00 2001 From: Krinkle Date: Wed, 24 Aug 2011 19:35:18 +0000 Subject: [PATCH] Add comments and fix whitespace for r90657, r86305 --- resources/jquery/jquery.tablesorter.js | 5 ++-- .../jquery/jquery.tablesorter.test.js | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 3470100a44..e7691858b8 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -8,8 +8,9 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * @depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort, + * Depends on mw.config (wgDigitTransformTable, wgMonthNames, wgMonthNamesShort, * wgDefaultDateFormat, wgContentLanguage) + * Uses 'tableSorterCollation' in mw.config (if available) */ /** * @@ -222,7 +223,7 @@ realCellIndex = 0, $tableHeaders = $( 'thead:eq(0) tr', table ); if ( $tableHeaders.length > 1 ) { - $tableHeaders.each(function() { + $tableHeaders.each( function() { if ( this.cells.length > maxSeen ) { maxSeen = this.cells.length; longest = this; diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js index ea3cc9b803..fddf8444be 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js @@ -286,15 +286,20 @@ tableTest( umlautWords, umlautWordsSorted, function( $table ) { - mw.config.set( 'tableSorterCollation', {'ä':'ae', 'ö' : 'oe', 'ß': 'ss', 'ü':'ue'}); + mw.config.set( 'tableSorterCollation', { + 'ä': 'ae', + 'ö' : 'oe', + 'ß': 'ss', + 'ü':'ue' + } ); $table.tablesorter(); $table.find( '.headerSort:eq(0)' ).click(); mw.config.set( 'tableSorterCollation', {} ); } ); -var planetsRowspan =[["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus]; -var planetsRowspanII =[jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']]; +var planetsRowspan = [["Earth","6051.8"], jupiter, ["Mars","6051.8"], mercury, saturn, venus]; +var planetsRowspanII = [jupiter, mercury, saturn, ['Venus', '6371.0'], venus, ['Venus', '3390.0']]; tableTest( 'Basic planet table: Same value for multiple rows via rowspan', @@ -302,9 +307,13 @@ tableTest( planets, planetsRowspan, function( $table ) { - //Quick&Dirty mod + // Modify the table to have a multiuple-row-spanning cell: + // - Remove 2nd cell of 4th row, and, 2nd cell or 5th row. $table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove(); + // - Set rowspan for 2nd cell of 3rd row to 3. + // This covers the removed cell in the 4th and 5th row. $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' ); + $table.tablesorter(); $table.find( '.headerSort:eq(0)' ).click(); } @@ -315,9 +324,13 @@ tableTest( planets, planetsRowspanII, function( $table ) { - //Quick&Dirty mod + // Modify the table to have a multiuple-row-spanning cell: + // - Remove 1st cell of 4th row, and, 1st cell or 5th row. $table.find( 'tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)' ).remove(); + // - Set rowspan for 1st cell of 3rd row to 3. + // This covers the removed cell in the 4th and 5th row. $table.find( 'tr:eq(2) td:eq(0)' ).prop( 'rowspan', '3' ); + $table.tablesorter(); $table.find( '.headerSort:eq(0)' ).click(); } -- 2.20.1