The code that uses this will already work fine, we only need to change
how the regex is built.
Bug: T140240
Change-Id: I014d9b13815d8ae085a6ed7c6df2d62337bb46f7
for ( key in ts.collationTable ) {
// Check hasOwn to be safe
if ( ts.collationTable.hasOwnProperty( key ) ) {
- keys.push( key );
+ keys.push( mw.RegExp.escape( key ) );
}
}
if ( keys.length ) {
- ts.collationRegex = new RegExp( '[' + keys.join( '' ) + ']', 'ig' );
+ ts.collationRegex = new RegExp( keys.join( '|' ), 'ig' );
}
}
}
[ 'Strasse' ]
],
+ // Data set "digraph"
+ digraphWords = [
+ [ 'London' ],
+ [ 'Ljubljana' ],
+ [ 'Luxembourg' ],
+ [ 'Njivice' ],
+ [ 'Norwich' ],
+ [ 'New York' ]
+ ],
+ digraphWordsSorted = [
+ [ 'London' ],
+ [ 'Luxembourg' ],
+ [ 'Ljubljana' ],
+ [ 'New York' ],
+ [ 'Norwich' ],
+ [ 'Njivice' ]
+ ],
+
complexMDYDates = [
[ 'January, 19 2010' ],
[ 'April 21 1991' ],
}
);
+ tableTest(
+ 'Digraphs with custom collation',
+ [ 'City' ],
+ digraphWords,
+ digraphWordsSorted,
+ function ( $table ) {
+ mw.config.set( 'tableSorterCollation', {
+ lj: 'lzzzz',
+ nj: 'nzzzz'
+ } );
+
+ $table.tablesorter();
+ $table.find( '.headerSort:eq(0)' ).click();
+ }
+ );
+
QUnit.test( 'Rowspan not exploded on init', 1, function ( assert ) {
var $table = tableCreate( header, planets );