http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90655
Revision: 90655
Author: diebuche
Date: 2011-06-23 07:39:56 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
Adding a collation test to tablesorter, fixing var ref from r90630
Modified Paths:
--------------
trunk/phase3/resources/jquery/jquery.tablesorter.js
trunk/phase3/tests/qunit/index.html
trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
Modified: trunk/phase3/resources/jquery/jquery.tablesorter.js
===================================================================
--- trunk/phase3/resources/jquery/jquery.tablesorter.js 2011-06-23 07:20:21 UTC
(rev 90654)
+++ trunk/phase3/resources/jquery/jquery.tablesorter.js 2011-06-23 07:39:56 UTC
(rev 90655)
@@ -481,7 +481,7 @@
}
}
if (keys.length) {
- ts.collationRegex = new RegExp(
'[' + ts.collationRegex.join('') + ']', 'ig' );
+ ts.collationRegex = new RegExp(
'[' + keys.join('') + ']', 'ig' );
}
}
}
Modified: trunk/phase3/tests/qunit/index.html
===================================================================
--- trunk/phase3/tests/qunit/index.html 2011-06-23 07:20:21 UTC (rev 90654)
+++ trunk/phase3/tests/qunit/index.html 2011-06-23 07:39:56 UTC (rev 90655)
@@ -60,7 +60,7 @@
<script src="suites/resources/jquery/jquery.autoEllipsis.js"></script>
<script src="suites/resources/jquery/jquery.colorUtil.js"></script>
<script src="suites/resources/jquery/jquery.tabIndex.js"></script>
- <script
src="suites/resources/jquery/jquery.tablesorter.test.js"></script>
+ <script src="suites/resources/jquery/jquery.tablesorter.test.js"
charset="UTF-8"></script>
<script src="suites/resources/mediawiki/mediawiki.Title.js"></script>
<!-- TestSwarm: If a test swarm is running this,
Modified:
trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
===================================================================
--- trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
2011-06-23 07:20:21 UTC (rev 90654)
+++ trunk/phase3/tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
2011-06-23 07:39:56 UTC (rev 90655)
@@ -27,7 +27,7 @@
$.each(header, function(i, str) {
var $th = $('<th>');
$th.text(str).appendTo($tr);
- })
+ });
$tr.appendTo($thead);
for (var i = 0; i < data.length; i++) {
@@ -35,7 +35,7 @@
$.each(data[i], function(j, str) {
var $td = $('<td>');
$td.text(str).appendTo($tr);
- })
+ });
$tr.appendTo($tbody);
}
return $table;
@@ -53,7 +53,7 @@
var row = [];
$(tr).find('td,th').each(function(i, td) {
row.push($(td).text());
- })
+ });
data.push(row);
});
return data;
@@ -82,7 +82,7 @@
// 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 );
- deepEqual( extracted, expected, msg )
+ deepEqual( extracted, expected, msg );
});
};
@@ -90,7 +90,7 @@
var arr2 = arr.slice(0);
arr2.reverse();
return arr2;
-}
+};
// Sample data set: some planets!
var header = ['Planet', 'Radius (km)'],
@@ -255,4 +255,47 @@
}
);
+var umlautWords = [
+ // Some words with Umlauts
+ ['Günther'],
+ ['Peter'],
+ ['Björn'],
+ ['Bjorn'],
+ ['Apfel'],
+ ['Äpfel'],
+ ['Strasse'],
+ ['Sträßschen']
+];
+
+var umlautWordsSorted = [
+ // Some words with Umlauts
+ ['Äpfel'],
+ ['Apfel'],
+ ['Björn'],
+ ['Bjorn'],
+ ['Günther'],
+ ['Peter'],
+ ['Sträßschen'],
+ ['Strasse']
+];
+
+tableTest(
+ 'Accented Characters with custom collation',
+ ['Name'],
+ umlautWords,
+ umlautWordsSorted,
+ function( $table ) {
+ mw.config.set('tableSorterCollation', {'ä':'ae', 'ö' : 'oe',
'ß': 'ss', 'ü':'ue'});
+ $table.tablesorter();
+ $table.find('.headerSort:eq(0)').click();
+ mw.config.set('tableSorterCollation', {});
+ }
+);
+
+
+
+
+
+
+
})();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs