-(function() {
+( function ( $ ) {
-module( 'jquery.tablesorter' );
-
-// setup hack
-mw.config.set( 'wgMonthNames', [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] );
-mw.config.set( 'wgMonthNamesShort', ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] );
-mw.config.set( 'wgDefaultDateFormat', 'dmy' );
+var config = {
+ 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',
+ wgContentLanguage: 'en'
+};
+module( 'jquery.tablesorter', QUnit.newMwEnvironment({ config: config }) );
test( '-- Initial check', function() {
expect(1);
expect(1);
var $table = tableCreate( header, data );
- //$( 'body' ).append($table);
// Give caller a chance to set up sorting and manipulate the table.
callback( $table );
['11.11.2011']
],
function( $table ) {
- // @fixme reset it at end or change module to allow us to override it
mw.config.set( 'wgDefaultDateFormat', 'dmy' );
+ mw.config.set( 'wgContentLanguage', 'de' );
+
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
['11.11.2011']
],
function( $table ) {
- // @fixme reset it at end or change module to allow us to override it
mw.config.set( 'wgDefaultDateFormat', 'mdy' );
+
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
'ß': 'ss',
'ü':'ue'
} );
+
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
- mw.config.set( 'tableSorterCollation', {} );
}
);
complexMDYSorted,
function( $table ) {
mw.config.set( 'wgDefaultDateFormat', 'mdy' );
+
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
[ '13,000'],
[ '9' ],
[ '14' ],
- [ '8.0' ],
+ [ '8.0' ]
];
var numbersAsc = [
[ '7' ],
[ '9' ],
[ '12' ],
[ '14' ],
- [ '13,000'],
+ [ '13,000']
];
tableTest( 'bug 8115: sort numbers with commas (ascending)',
}
);
-alert( mw.config.get( "wgContentLanguage" ) );
-
tableTest( 'bug 8115: sort numbers with commas (descending)',
['Numbers'], numbers, reversed(numbersAsc),
function( $table ) {
);
// TODO add numbers sorting tests for bug 8115 with a different language
+test( 'bug 32888 - Tables inside a tableheader cell', function() {
+ expect(2);
+
+ var $table;
+ $table = $(
+ '<table class="sortable" id="32888">' +
+ '<tr><th>header<table id="32888-2">'+
+ '<tr><th>1</th><th>2</th></tr>' +
+ '</table></th></tr>' +
+ '<tr><td>A</td></tr>' +
+ '<tr><td>B</td></tr>' +
+ '</table>'
+ );
+ $table.tablesorter();
+
+ equals(
+ $table.find('> thead:eq(0) > tr > th.headerSort').length,
+ 1,
+ 'Child tables inside a headercell should not interfere with sortable headers (bug 32888)'
+ );
+ equals(
+ $('#32888-2').find('th.headerSort').length,
+ 0,
+ 'The headers of child tables inside a headercell should not be sortable themselves (bug 32888)'
+ );
+});
-})();
+})( jQuery );