From 3d8d9c116f3f939abbfbfd28bee6bcca7a5ba076 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 20 May 2017 16:20:21 +0100 Subject: Write thead and th for headers in table --- test/document-to-html.tests.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test') 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 = "" + + "" + + "" + + "
"; + 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 = "" + + "" + + "
"; + assert.equal(result.value, expectedHtml); + }); +}); + test('empty cells are preserved in table', function() { var table = new documents.Table([ new documents.TableRow([ -- cgit v1.2.3