From eae1dd0b509fbe201ba5f7ed530fd1bf8329904a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 4 Nov 2017 10:54:34 +0000 Subject: Use table style mappings during document conversion --- test/document-to-html.tests.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index 861033b..8e6546b 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -419,6 +419,23 @@ test('docx table is converted to table in HTML', function() { }); }); +test('table style mappings can be used to map tables', function() { + var table = new documents.Table([], {styleName: "Normal Table"}); + var converter = new DocumentConverter({ + styleMap: [ + { + from: documentMatchers.table({styleName: documentMatchers.equalTo("Normal Table")}), + to: htmlPaths.topLevelElement("table", {"class": "normal-table"}) + } + ] + }); + + return converter.convertToHtml(table).then(function(result) { + var expectedHtml = '
'; + assert.equal(result.value, expectedHtml); + }); +}); + test('header rows are wrapped in thead', function() { var table = new documents.Table([ new documents.TableRow([new documents.TableCell([])], {isHeader: true}), -- cgit v1.2.3