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=b8d816e981da8d6f8030c0bd491e42d2e97c659c;hpb=ea0776b1e8a635f1c3e8dbe9149c06b1dac71be3;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 b8d816e981..435346494c 100644
--- a/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
+++ b/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
@@ -5,10 +5,12 @@
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'
};
- QUnit.module( 'jquery.tablesorter', QUnit.newMwEnvironment({ config: config }) );
+ QUnit.module( 'jquery.tablesorter', QUnit.newMwEnvironment( { config: config } ) );
/**
* Create an HTML table from an array of row arrays containing text strings.
@@ -18,7 +20,7 @@
* @param {String[][]} data
* @return jQuery
*/
- function tableCreate( header, data ) {
+ function tableCreate( header, data ) {
var i,
$table = $( '
' ),
$thead = $table.find( 'thead' ),
@@ -28,7 +30,7 @@
$.each( header, function ( i, str ) {
var $th = $( '' );
$th.text( str ).appendTo( $tr );
- });
+ } );
$tr.appendTo( $thead );
for ( i = 0; i < data.length; i++ ) {
@@ -37,7 +39,7 @@
$.each( data[i], function ( j, str ) {
var $td = $( ' | ' );
$td.text( str ).appendTo( $tr );
- });
+ } );
$tr.appendTo( $tbody );
}
return $table;
@@ -52,13 +54,13 @@
function tableExtract( $table ) {
var data = [];
- $table.find( 'tbody' ).find( 'tr' ).each( function( i, tr ) {
+ $table.find( 'tbody' ).find( 'tr' ).each( function ( i, tr ) {
var row = [];
- $( tr ).find( 'td,th' ).each( function( i, td ) {
+ $( tr ).find( 'td,th' ).each( function ( i, td ) {
row.push( $( td ).text() );
- });
+ } );
data.push( row );
- });
+ } );
return data;
}
@@ -83,12 +85,40 @@
// to asynchronous, we'll need a timeout or a callback here.
var extracted = tableExtract( $table );
assert.deepEqual( extracted, expected, msg );
- });
+ } );
}
- function reversed(arr) {
+ /**
+ * Run a table test by building a table with the given HTML,
+ * running some callback on it, then checking the results.
+ *
+ * @param {String} msg text to pass on to qunit for the comparison
+ * @param {String} HTML to make the table
+ * @param {String[][]} expected rows/cols to compare against at end
+ * @param {function($table)} callback something to do with the table before we compare
+ */
+ function tableTestHTML( msg, html, expected, callback ) {
+ QUnit.test( msg, 1, function ( assert ) {
+ var $table = $( html );
+
+ // Give caller a chance to set up sorting and manipulate the table.
+ if ( callback ) {
+ callback( $table );
+ } else {
+ $table.tablesorter();
+ $table.find( '#sortme' ).click();
+ }
+
+ // Table sorting is done synchronously; if it ever needs to change back
+ // to asynchronous, we'll need a timeout or a callback here.
+ var extracted = tableExtract( $table );
+ assert.deepEqual( extracted, expected, msg );
+ } );
+ }
+
+ function reversed( arr ) {
// Clone array
- var arr2 = arr.slice(0);
+ var arr2 = arr.slice( 0 );
arr2.reverse();
@@ -96,17 +126,17 @@
}
// Sample data set using planets named and their radius
- var header = [ 'Planet' , 'Radius (km)'],
+ var header = [ 'Planet' , 'Radius (km)'],
mercury = [ 'Mercury', '2439.7' ],
- venus = [ 'Venus' , '6051.8' ],
- earth = [ 'Earth' , '6371.0' ],
- mars = [ 'Mars' , '3390.0' ],
- jupiter = [ 'Jupiter', '69911' ],
- saturn = [ 'Saturn' , '58232' ];
+ venus = [ 'Venus' , '6051.8' ],
+ earth = [ 'Earth' , '6371.0' ],
+ mars = [ 'Mars' , '3390.0' ],
+ jupiter = [ 'Jupiter', '69911' ],
+ saturn = [ 'Saturn' , '58232' ];
// Initial data set
- var planets = [mercury, venus, earth, mars, jupiter, saturn];
- var ascendingName = [earth, jupiter, mars, mercury, saturn, venus];
+ var planets = [mercury, venus, earth, mars, jupiter, saturn];
+ var ascendingName = [earth, jupiter, mars, mercury, saturn, venus];
var ascendingRadius = [mercury, mars, venus, earth, saturn, jupiter];
tableTest(
@@ -115,16 +145,20 @@
planets,
ascendingName,
function ( $table ) {
- $table.tablesorter( { sortList: [ { 0: 'asc' } ] } );
+ $table.tablesorter( { sortList: [
+ { 0: 'asc' }
+ ] } );
}
);
tableTest(
'Basic planet table: sorting initially - descending by radius',
header,
planets,
- reversed(ascendingRadius),
+ reversed( ascendingRadius ),
function ( $table ) {
- $table.tablesorter( { sortList: [ { 1: 'desc' } ] } );
+ $table.tablesorter( { sortList: [
+ { 1: 'desc' }
+ ] } );
}
);
tableTest(
@@ -147,11 +181,23 @@
$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,
planets,
- reversed(ascendingName),
+ reversed( ascendingName ),
function ( $table ) {
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click().click();
@@ -171,7 +217,7 @@
'Basic planet table: descending radius',
header,
planets,
- reversed(ascendingRadius),
+ reversed( ascendingRadius ),
function ( $table ) {
$table.tablesorter();
$table.find( '.headerSort:eq(1)' ).click().click();
@@ -198,7 +244,10 @@
asc,
function ( $table ) {
$table.tablesorter(
- { sortList: [ { 0: 'asc' }, { 1: 'asc' } ] }
+ { sortList: [
+ { 0: 'asc' },
+ { 1: 'asc' }
+ ] }
);
}
);
@@ -210,7 +259,10 @@
function ( $table ) {
$table.tablesorter();
$table.data( 'tablesorter' ).sort(
- [ { 0: 'desc' }, { 1: 'asc' } ]
+ [
+ { 0: 'desc' },
+ { 1: 'asc' }
+ ]
);
}
);
@@ -221,18 +273,56 @@
asc,
function ( $table ) {
$table.tablesorter(
- { sortList: [ { 0: 'asc' }, { 1: 'asc' } ] }
+ { sortList: [
+ { 0: 'asc' },
+ { 1: 'asc' }
+ ] }
);
$table.data( 'tablesorter' ).sort(
- [ { 0: 'desc' }, { 1: 'asc' } ]
+ [
+ { 0: 'desc' },
+ { 1: 'asc' }
+ ]
);
$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(
- { sortList: [ { 0: 'desc' }, { 1: 'asc' } ] }
+ { sortList: [
+ { 0: 'desc' },
+ { 1: 'asc' }
+ ] }
);
$table.data( 'tablesorter' ).sort( [] );
@@ -278,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,
@@ -291,19 +395,36 @@
$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(
'Bug 28775: German-style (dmy) short numeric dates',
['Date'],
- [ // German-style dates are day-month-year
+ [
+ // German-style dates are day-month-year
['11.11.2011'],
['01.11.2011'],
['02.10.2011'],
['03.08.2011'],
['09.11.2011']
],
- [ // Sorted by ascending date
+ [
+ // Sorted by ascending date
['03.08.2011'],
['02.10.2011'],
['01.11.2011'],
@@ -322,14 +443,16 @@
tableTest(
'Bug 28775: American-style (mdy) short numeric dates',
['Date'],
- [ // American-style dates are month-day-year
+ [
+ // American-style dates are month-day-year
['11.11.2011'],
['01.11.2011'],
['02.10.2011'],
['03.08.2011'],
['09.11.2011']
],
- [ // Sorted by ascending date
+ [
+ // Sorted by ascending date
['01.11.2011'],
['02.10.2011'],
['03.08.2011'],
@@ -381,7 +504,7 @@
'Bug 17141: IPv4 address sorting (reverse)',
['IP'],
ipv4,
- reversed(ipv4Sorted),
+ reversed( ipv4Sorted ),
function ( $table ) {
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click().click();
@@ -422,7 +545,7 @@
'ä': 'ae',
'ö': 'oe',
'Ã': 'ss',
- 'ü':'ue'
+ 'ü': 'ue'
} );
$table.tablesorter();
@@ -447,9 +570,16 @@
3,
'Rowspan not exploded'
);
- });
+ } );
- var planetsRowspan = [ [ 'Earth', '6051.8' ], jupiter, [ 'Mars', '6051.8' ], mercury, saturn, venus ];
+ var planetsRowspan = [
+ [ 'Earth', '6051.8' ],
+ jupiter,
+ [ 'Mars', '6051.8' ],
+ mercury,
+ saturn,
+ venus
+ ];
var planetsRowspanII = [ jupiter, mercury, saturn, venus, [ 'Venus', '6371.0' ], [ 'Venus', '3390.0' ] ];
tableTest(
@@ -482,7 +612,9 @@
// This covers the removed cell in the 4th and 5th row.
$table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
- $table.tablesorter( { sortList: [ { 0: 'asc' } ] } );
+ $table.tablesorter( { sortList: [
+ { 0: 'asc' }
+ ] } );
}
);
tableTest(
@@ -566,7 +698,7 @@
}
);
- var ascendingNameLegacy = ascendingName.slice(0);
+ var ascendingNameLegacy = ascendingName.slice( 0 );
ascendingNameLegacy[4] = ascendingNameLegacy[5];
ascendingNameLegacy.pop();
@@ -575,22 +707,22 @@
header,
planets,
ascendingNameLegacy,
- function( $table ) {
+ function ( $table ) {
$table.find( 'tr:last' ).addClass( 'sortbottom' );
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
);
- QUnit.test( 'Test detection routine', function ( assert ) {
+ QUnit.test( 'Test detection routine', 1, function ( assert ) {
var $table;
$table = $(
'' +
- 'CAPTION' +
- 'THEAD | ' +
- '1 | ' +
- 'text | ' +
- ' '
+ 'CAPTION' +
+ ' | THEAD |
' +
+ '1 |
' +
+ 'text |
' +
+ ''
);
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
@@ -603,27 +735,27 @@
} );
/** FIXME: the diff output is not very readeable. */
- QUnit.test( 'bug 32047 - caption must be before thead', function ( assert ) {
+ QUnit.test( 'bug 32047 - caption must be before thead', 1, function ( assert ) {
var $table;
$table = $(
'' +
- 'CAPTION' +
- 'THEAD |
' +
- 'A |
' +
- 'B |
' +
- 'TFOOT |
' +
- '
'
- );
+ 'CAPTION' +
+ 'THEAD |
' +
+ 'A |
' +
+ 'B |
' +
+ 'TFOOT |
' +
+ ''
+ );
$table.tablesorter();
assert.equal(
- $table.children( ).get( 0 ).nodeName,
+ $table.children().get( 0 ).nodeName,
'CAPTION',
'First element after must be (bug 32047)'
);
- });
+ } );
- QUnit.test( 'data-sort-value attribute, when available, should override sorting position', function ( assert ) {
+ QUnit.test( 'data-sort-value attribute, when available, should override sorting position', 3, function ( assert ) {
var $table, data;
// Example 1: All cells except one cell without data-sort-value,
@@ -636,34 +768,38 @@
'Ferret |
' +
'Elephant |
' +
'Dolphin |
' +
- ''
+ ''
);
$table.tablesorter().find( '.headerSort:eq(0)' ).click();
data = [];
- $table.find( 'tbody > tr' ).each( function( i, tr ) {
- $( tr ).find( 'td' ).each( function( i, td ) {
+ $table.find( 'tbody > tr' ).each( function ( i, tr ) {
+ $( tr ).find( 'td' ).each( function ( i, td ) {
data.push( {
data: $( td ).data( 'sortValue' ),
text: $( td ).text()
} );
- });
- });
+ } );
+ } );
assert.deepEqual( data, [
{
data: 'Apple',
text: 'Bird'
- }, {
+ },
+ {
data: 'Bananna',
text: 'Ferret'
- }, {
+ },
+ {
data: undefined,
text: 'Cheetah'
- }, {
+ },
+ {
data: 'Cherry',
text: 'Dolphin'
- }, {
+ },
+ {
data: 'Drupe',
text: 'Elephant'
}
@@ -678,7 +814,7 @@
'B |
' +
'G |
' +
'C |
' +
- ''
+ ''
);
$table.tablesorter().find( '.headerSort:eq(0)' ).click();
@@ -689,23 +825,27 @@
data: $( td ).data( 'sortValue' ),
text: $( td ).text()
} );
- });
- });
+ } );
+ } );
assert.deepEqual( data, [
{
data: undefined,
text: 'B'
- }, {
+ },
+ {
data: undefined,
text: 'D'
- }, {
+ },
+ {
data: 'E',
text: 'A'
- }, {
+ },
+ {
data: 'F',
text: 'C'
- }, {
+ },
+ {
data: undefined,
text: 'G'
}
@@ -721,7 +861,7 @@
'B |
' +
'G |
' +
'C |
' +
- ''
+ ''
);
// initialize table sorter and sort once
$table
@@ -741,35 +881,39 @@
$table.find( '.headerSort:eq(0)' ).click();
data = [];
- $table.find( 'tbody > tr' ).each( function( i, tr ) {
- $( tr ).find( 'td' ).each( function( i, td ) {
+ $table.find( 'tbody > tr' ).each( function ( i, tr ) {
+ $( tr ).find( 'td' ).each( function ( i, td ) {
data.push( {
data: $( td ).data( 'sortValue' ),
text: $( td ).text()
} );
- });
- });
+ } );
+ } );
assert.deepEqual( data, [
{
data: 1,
text: 'B'
- }, {
+ },
+ {
data: 2,
text: 'G'
- }, {
+ },
+ {
data: 3,
text: 'A'
- }, {
+ },
+ {
data: undefined,
text: 'C'
- }, {
+ },
+ {
data: undefined,
text: 'D'
}
], 'Order matches expected order, using the current sortValue in $.data()' );
- });
+ } );
var numbers = [
[ '12' ],
@@ -790,15 +934,15 @@
tableTest( 'bug 8115: sort numbers with commas (ascending)',
['Numbers'], numbers, numbersAsc,
- function( $table ) {
+ function ( $table ) {
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click();
}
);
tableTest( 'bug 8115: sort numbers with commas (descending)',
- ['Numbers'], numbers, reversed(numbersAsc),
- function( $table ) {
+ ['Numbers'], numbers, reversed( numbersAsc ),
+ function ( $table ) {
$table.tablesorter();
$table.find( '.headerSort:eq(0)' ).click().click();
}
@@ -809,26 +953,26 @@
var $table;
$table = $(
'' +
- 'header'+
+ 'header | ' +
- 'A | ' +
- 'B | ' +
- ' '
- );
+ ' |
---|
' +
+ 'A |
' +
+ 'B |
' +
+ ''
+ );
$table.tablesorter();
assert.equal(
- $table.find('> thead:eq(0) > tr > th.headerSort').length,
+ $table.find( '> thead:eq(0) > tr > th.headerSort' ).length,
1,
'Child tables inside a headercell should not interfere with sortable headers (bug 32888)'
);
assert.equal(
- $( '#mw-bug-32888-2' ).find('th.headerSort').length,
+ $( '#mw-bug-32888-2' ).find( 'th.headerSort' ).length,
0,
'The headers of child tables inside a headercell should not be sortable themselves (bug 32888)'
);
- });
+ } );
var correctDateSorting1 = [
@@ -881,61 +1025,176 @@
}
);
-QUnit.test( 'Sorting images using alt text', function ( assert ) {
- var $table = $(
+ QUnit.test( 'Sorting images using alt text', 1, function ( assert ) {
+ var $table = $(
+ '' +
+ 'THEAD |
' +
+ ' |
' +
+ '1 |
' +
+ '
'
+ );
+ $table.tablesorter().find( '.headerSort:eq(0)' ).click();
+
+ assert.equal(
+ $table.find( 'td' ).first().text(),
+ '1',
+ 'Applied correct sorting order'
+ );
+ } );
+
+ QUnit.test( 'Sorting images using alt text (complex)', 1, function ( assert ) {
+ var $table = $(
+ '' +
+ 'THEAD |
' +
+ 'A |
' +
+ 'CC |
' +
+ 'F |
' +
+ 'E |
' +
+ 'D |
' +
+ 'C |
' +
+ '
'
+ );
+ $table.tablesorter().find( '.headerSort:eq(0)' ).click();
+
+ assert.equal(
+ $table.find( 'td' ).text(),
+ 'CDEFCCA',
+ 'Applied correct sorting order'
+ );
+ } );
+
+ QUnit.test( 'Sorting images using alt text (with format autodetection)', 1, function ( assert ) {
+ var $table = $(
+ '' +
+ 'THEAD |
' +
+ '7 |
' +
+ '1 |
' +
+ '5 |
' +
+ '4 |
' +
+ '
'
+ );
+ $table.tablesorter().find( '.headerSort:eq(0)' ).click();
+
+ assert.equal(
+ $table.find( 'td' ).text(),
+ '4517',
+ 'Applied correct sorting order'
+ );
+ } );
+
+ // bug 41889 - exploding rowspans in more complex cases
+ tableTestHTML(
+ 'Rowspan exploding with row headers',
+ '' +
+ 'n | foo | bar | baz |
' +
+ '' +
+ '1 | foo | bar | baz |
' +
+ '2 | baz |
' +
+ '
',
+ [
+ [ '1', 'foo', 'bar', 'baz' ],
+ [ '2', 'foo', 'bar', 'baz' ]
+ ]
+ );
+
+ tableTestHTML(
+ 'Rowspan exploding with colspanned cells',
'' +
- 'THEAD |
' +
- ' |
' +
- '1 |
' +
- '
'
+ 'n | foo | bar | baz |
' +
+ '' +
+ '1 | foo | bar | baz |
' +
+ '2 | foobar |
' +
+ '',
+ [
+ [ '1', 'foo', 'bar', 'baz' ],
+ [ '2', 'foobar', 'baz' ]
+ ]
);
- $table.tablesorter().find( '.headerSort:eq(0)' ).click();
- assert.equal(
- $table.find( 'td' ).first().text(),
- '1',
- 'Applied correct sorting order'
+ tableTestHTML(
+ 'Rowspan exploding with colspanned cells (2)',
+ '' +
+ 'n | foo | bar | baz | quux |
' +
+ '' +
+ '1 | foo | bar | baz | quux |
' +
+ '2 | foobar | quux |
' +
+ '
',
+ [
+ [ '1', 'foo', 'bar', 'baz', 'quux' ],
+ [ '2', 'foobar', 'baz', 'quux' ]
+ ]
);
-} );
-QUnit.test( 'Sorting images using alt text (complex)', function ( assert ) {
- var $table = $(
+ tableTestHTML(
+ 'Rowspan exploding with rightmost rows spanning most',
'' +
- 'THEAD |
' +
- 'A |
' +
- 'CC |
' +
- 'F |
' +
- 'E |
' +
- 'D |
' +
- 'C |
' +
- '
'
- );
- $table.tablesorter().find( '.headerSort:eq(0)' ).click();
-
- assert.equal(
- $table.find( 'td' ).text(),
- 'CDEFCCA',
- 'Applied correct sorting order'
- );
-} );
-
-QUnit.test( 'Sorting images using alt text (with format autodetection)', function ( assert ) {
- var $table = $(
+ 'n | foo | bar |
' +
+ '' +
+ '1 | foo | bar |
' +
+ '2 |
' +
+ '3 | foo |
' +
+ '4 |
' +
+ '',
+ [
+ [ '1', 'foo', 'bar' ],
+ [ '2', 'foo', 'bar' ],
+ [ '3', 'foo', 'bar' ],
+ [ '4', 'foo', 'bar' ]
+ ]
+ );
+
+ tableTestHTML(
+ 'Rowspan exploding with rightmost rows spanning most (2)',
'' +
- 'THEAD |
' +
- '7 |
' +
- '1 |
' +
- '5 |
' +
- '4 |
' +
- '
'
+ 'n | foo | bar | baz |
' +
+ '' +
+ '1 | foo | bar | baz |
' +
+ '2 | baz |
' +
+ '3 | foo | baz |
' +
+ '4 | baz |
' +
+ '',
+ [
+ [ '1', 'foo', 'bar', 'baz' ],
+ [ '2', 'foo', 'bar', 'baz' ],
+ [ '3', 'foo', 'bar', 'baz' ],
+ [ '4', 'foo', 'bar', 'baz' ]
+ ]
);
- $table.tablesorter().find( '.headerSort:eq(0)' ).click();
- assert.equal(
- $table.find( 'td' ).text(),
- '4517',
- 'Applied correct sorting order'
+ tableTestHTML(
+ 'Rowspan exploding with row-and-colspanned cells',
+ '' +
+ 'n | foo1 | foo2 | bar | baz |
' +
+ '' +
+ '1 | foo1 | foo2 | bar | baz |
' +
+ '2 | baz |
' +
+ '3 | foo | baz |
' +
+ '4 | baz |
' +
+ '
',
+ [
+ [ '1', 'foo1', 'foo2', 'bar', 'baz' ],
+ [ '2', 'foo1', 'foo2', 'bar', 'baz' ],
+ [ '3', 'foo', 'bar', 'baz' ],
+ [ '4', 'foo', 'bar', 'baz' ]
+ ]
+ );
+
+ tableTestHTML(
+ 'Rowspan exploding with uneven rowspan layout',
+ '' +
+ 'n | foo1 | foo2 | foo3 | bar | baz |
' +
+ '' +
+ '1 | foo1 | foo2 | foo3 | bar | baz |
' +
+ '2 | bar | baz |
' +
+ '3 | foo1 | foo2 | foo3 | baz |
' +
+ '4 | baz |
' +
+ '
',
+ [
+ [ '1', 'foo1', 'foo2', 'foo3', 'bar', 'baz' ],
+ [ '2', 'foo1', 'foo2', 'foo3', 'bar', 'baz' ],
+ [ '3', 'foo1', 'foo2', 'foo3', 'bar', 'baz' ],
+ [ '4', 'foo1', 'foo2', 'foo3', 'bar', 'baz' ]
+ ]
);
-} );
}( jQuery, mediaWiki ) );