diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-05-20 16:20:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-05-20 16:20:21 +0100 |
| commit | 3d8d9c116f3f939abbfbfd28bee6bcca7a5ba076 (patch) | |
| tree | 163635267854ab56c5fc9de69ff0984e57db5625 /test | |
| parent | 9a4da2889ceaaed5351e4bb50d9f1660c5e3ee27 (diff) | |
Write thead and th for headers in table
Diffstat (limited to 'test')
| -rw-r--r-- | test/document-to-html.tests.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index 8124ad1..baa7df9 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -384,6 +384,37 @@ test('docx table is converted to table in HTML', function() { }); }); +test('header rows are wrapped in thead', function() { + var table = new documents.Table([ + new documents.TableRow([new documents.TableCell([])], {isHeader: true}), + new documents.TableRow([new documents.TableCell([])], {isHeader: true}), + new documents.TableRow([new documents.TableCell([])], {isHeader: false}) + ]); + var converter = new DocumentConverter(); + + return converter.convertToHtml(table).then(function(result) { + var expectedHtml = "<table>" + + "<thead><tr><th></th></tr><tr><th></th></tr></thead>" + + "<tbody><tr><td></td></tr></tbody>" + + "</table>"; + assert.equal(result.value, expectedHtml); + }); +}); + +test('tbody is omitted if all rows are headers', function() { + var table = new documents.Table([ + new documents.TableRow([new documents.TableCell([])], {isHeader: true}) + ]); + var converter = new DocumentConverter(); + + return converter.convertToHtml(table).then(function(result) { + var expectedHtml = "<table>" + + "<thead><tr><th></th></tr></thead>" + + "</table>"; + assert.equal(result.value, expectedHtml); + }); +}); + test('empty cells are preserved in table', function() { var table = new documents.Table([ new documents.TableRow([ |
