on tablesort, verify <caption> is the first child in the table
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 10 Nov 2011 22:54:29 +0000 (22:54 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 10 Nov 2011 22:54:29 +0000 (22:54 +0000)
r102303 tried to compare the whole table when bug 32047 only require
we have <caption> as a first child.  Easier definition leads to easier
code!

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

index cf6ce28..0cc38f2 100644 (file)
@@ -393,19 +393,13 @@ test( 'bug 32047 - caption must be before thead', function() {
                '<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)' );
+
+       equals(
+               $table.children( ).get( 0 ).nodeName,
+               'CAPTION',
+               'First element after <thead> must be <caption> (bug 32047)'
+       );
 });
 
 test( 'data-sort-value attribute, when available, should override sorting position', function() {