X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fjquery%2Fjquery.tablesorter.test.js;h=435346494c5955d1fcc077a6c2056d266468c91a;hb=7636bea2bf3ccc33389a97d968bdda64036f59c0;hp=1a380a57618340756bfa57162abd735f6d447137;hpb=f07887f50febf8b7744908b84fcbb5d7c40be501;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js index 1a380a5761..435346494c 100644 --- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js @@ -5,6 +5,8 @@ wgMonthNames: ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], wgMonthNamesShort: ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], wgDefaultDateFormat: 'dmy', + wgSeparatorTransformTable: ['', ''], + wgDigitTransformTable: ['', ''], wgContentLanguage: 'en' }; @@ -179,6 +181,18 @@ $table.find( '.headerSort:eq(0)' ).click(); } ); + tableTest( + 'Basic planet table: ascending by name (multiple clicks)', + header, + planets, + ascendingName, + function ( $table ) { + $table.tablesorter(); + $table.find( '.headerSort:eq(0)' ).click(); + $table.find( '.headerSort:eq(1)' ).click(); + $table.find( '.headerSort:eq(0)' ).click(); + } + ); tableTest( 'Basic planet table: descending by name', header, @@ -273,6 +287,35 @@ $table.data( 'tablesorter' ).sort(); } ); + tableTest( + 'Sort via click event after having initialized the tablesorter with initial sorting', + header, + initial, + descasc, + function ( $table ) { + $table.tablesorter( + { sortList: [ { 0: 'asc' }, { 1: 'asc' } ] } + ); + $table.find( '.headerSort:eq(0)' ).click(); + } + ); + tableTest( + 'Multi-sort via click event after having initialized the tablesorter with initial sorting', + header, + initial, + asc, + function ( $table ) { + $table.tablesorter( + { sortList: [ { 0: 'desc' }, { 1: 'desc' } ] } + ); + $table.find( '.headerSort:eq(0)' ).click(); + + // Pretend to click while pressing the multi-sort key + var event = $.Event( 'click' ); + event[$table.data( 'tablesorter' ).config.sortMultiSortKey] = true; + $table.find( '.headerSort:eq(1)' ).trigger( event ); + } + ); QUnit.test( 'Reset sorting making table appear unsorted', 3, function ( assert ) { var $table = tableCreate( header, initial ); $table.tablesorter( @@ -325,6 +368,20 @@ $table.find( '.headerSort:eq(0)' ).click(); } ); + tableTest( 'Sorting with colspanned headers: sort spanned column twice', + header, + initial, + [ caa4, bbc2, abc3, aab5, aaa1 ], + function ( $table ) { + // Make colspanned header for test + $table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove(); + $table.find( 'tr:eq(0) th:eq(0)' ).prop( 'colspan', '3' ); + + $table.tablesorter(); + $table.find( '.headerSort:eq(0)' ).click(); + $table.find( '.headerSort:eq(0)' ).click(); + } + ); tableTest( 'Sorting with colspanned headers: subsequent column', header, initial, @@ -338,6 +395,21 @@ $table.find( '.headerSort:eq(1)' ).click(); } ); + tableTest( 'Sorting with colspanned headers: sort subsequent column twice', + header, + initial, + [ aab5, caa4, abc3, bbc2, aaa1 ], + function ( $table ) { + // Make colspanned header for test + $table.find( 'tr:eq(0) th:eq(1), tr:eq(0) th:eq(2)' ).remove(); + $table.find( 'tr:eq(0) th:eq(0)' ).prop( 'colspan', '3' ); + + $table.tablesorter(); + $table.find( '.headerSort:eq(1)' ).click(); + $table.find( '.headerSort:eq(1)' ).click(); + } + ); + // Regression tests! tableTest(