tests for bug 32047 / r102301
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 7 Nov 2011 17:48:42 +0000 (17:48 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 7 Nov 2011 17:48:42 +0000 (17:48 +0000)
In table with class="sortable", thead is before caption

tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js

index 72e5874..0aa4c79 100644 (file)
@@ -381,6 +381,33 @@ tableTest(
        }
 );
 
+/** FIXME: the diff output is not very readeable. */
+test( 'bug 32047 - caption must be before thead', function() {
+       var $table;
+       $table = $(
+               '<table class="sortable">' +
+               '<caption>CAPTION</caption>' +
+               '<tr><th>THEAD</th></tr>' +
+               '<tr><td>A</td></tr>' +
+               '<tr><td>B</td></tr>' +
+               '<tr class="sortbottom"><td>TFOOT</td></tr>' +
+               '</table>'
+               );
+       console.log( $table.html() );
+       $table.tablesorter();
+       console.log( $table.html() );
+       var expected =
+               '<caption>CAPTION</caption>'+
+               '<thead>' +
+               '<tr><th title=\"&lt;sort-ascending&gt;\" class=\"headerSort\">THEAD</th></tr>' +
+               '</thead>' +
+               '<tbody><tr><td>A</td></tr>' +
+               '<tr><td>B</td></tr>' +
+               '<tr class=\"sortbottom\"><td>TFOOT</td></tr>' +
+               '</tbody><tfoot></tfoot>';
+       deepEqual( $table.html(), expected, '<caption> must be placed before <thead> (bug 32047)' );
+});
+
 test( 'data-sort-value attribute, when available, should override sorting position', function() {
        var $table, data;