Skip to content

Commit

Permalink
tests cover multi tables rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed Aug 19, 2024
1 parent 2b2dcc5 commit 2153d2e
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,27 @@ function describeTestsWithOptions(options, postText) {
src += '| 3 | 33 | 333 | 3333 |\n';
src += '\n';
src += '{border=1}\n';
src += '| A |\n';
src += '| -- |\n';
src += '| 1 {colspan=3}|\n';
src += '| 2 |\n';
src += '| 3 |\n';
src += '\n';
src += '{border=2}\n';
src += '| A | B | C |\n';
src += '| -- | -- | -- |\n';
src += '| 1 {rowspan=2}| 11 | 111 |\n';
src += '| 2 {rowspan=2}| 22 | 222 |\n';
src += '| 3 | 33 | 333 |\n';
src += '\n';
src += '{border=3}\n';
src += '| A | B | C | D |\n';
src += '| -- | -- | -- | -- |\n';
src += '| 1 {colspan=2}| 11 {colspan=3} | 111| 1111 |\n';
src += '| 2 {rowspan=2} | 22 {colspan=2} | 222 | 2222 |\n';
src += '| 3 | 33 {colspan=2} | 333 | 3333 |\n';
src += '\n';
src += '{border=4}';
expected = '<table border="1">\n';
expected += '<thead>\n';
expected += '<tr>\n';
Expand All @@ -382,6 +403,73 @@ function describeTestsWithOptions(options, postText) {
expected += '</tr>\n';
expected += '</tbody>\n';
expected += '</table>\n';
expected += '<table border="2">\n';
expected += '<thead>\n';
expected += '<tr>\n';
expected += '<th>A</th>\n';
expected += '</tr>\n';
expected += '</thead>\n';
expected += '<tbody>\n';
expected += '<tr>\n';
expected += '<td colspan="3">1</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td>2</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td>3</td>\n';
expected += '</tr>\n';
expected += '</tbody>\n';
expected += '</table>\n';
expected += '<table border="3">\n';
expected += '<thead>\n';
expected += '<tr>\n';
expected += '<th>A</th>\n';
expected += '<th>B</th>\n';
expected += '<th>C</th>\n';
expected += '</tr>\n';
expected += '</thead>\n';
expected += '<tbody>\n';
expected += '<tr>\n';
expected += '<td rowspan="2">1</td>\n';
expected += '<td>11</td>\n';
expected += '<td>111</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td rowspan="2">2</td>\n';
expected += '<td>22</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td>3</td>\n';
expected += '<td>33</td>\n';
expected += '</tr>\n';
expected += '</tbody>\n';
expected += '</table>\n';
expected += '<table border="4">\n';
expected += '<thead>\n';
expected += '<tr>\n';
expected += '<th>A</th>\n';
expected += '<th>B</th>\n';
expected += '<th>C</th>\n';
expected += '<th>D</th>\n';
expected += '</tr>\n';
expected += '</thead>\n';
expected += '<tbody>\n';
expected += '<tr>\n';
expected += '<td colspan="2">1</td>\n';
expected += '<td colspan="3">11</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td rowspan="2">2</td>\n';
expected += '<td colspan="2">22</td>\n';
expected += '<td>222</td>\n';
expected += '</tr>\n';
expected += '<tr>\n';
expected += '<td>3</td>\n';
expected += '<td colspan="2">33</td>\n';
expected += '</tr>\n';
expected += '</tbody>\n';
expected += '</table>\n';
assert.equal(md.render(replaceDelimiters(src, options)), expected);
});

Expand Down

0 comments on commit 2153d2e

Please sign in to comment.