From dc31bacddd43e100a2793c76e26d35568262d89a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 17 Jun 2015 14:16:00 +0100 Subject: Add end-to-end tests for underline handling --- tests/mammoth.tests.js | 14 ++++++++++++++ tests/test-data/underline.docx | Bin 0 -> 12797 bytes 2 files changed, 14 insertions(+) create mode 100755 tests/test-data/underline.docx diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index f9571d2..e016fe1 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -203,6 +203,20 @@ describe('mammoth', function() { }); }); + test('underline is ignored by default', function() { + var docxPath = path.join(__dirname, "test-data/underline.docx"); + return mammoth.convertToHtml({path: docxPath}).then(function(result) { + assert.equal(result.value, '

The Sunset Tree

'); + }); + }); + + test('underline can be configured with convertUnderline option', function() { + var docxPath = path.join(__dirname, "test-data/underline.docx"); + return mammoth.convertToHtml({path: docxPath}, {convertUnderline: mammoth.underline.element("em")}).then(function(result) { + assert.equal(result.value, '

The Sunset Tree

'); + }); + }); + test('indentation is used if prettyPrint is true', function() { var docxPath = path.join(__dirname, "test-data/single-paragraph.docx"); return mammoth.convertToHtml({path: docxPath}, {prettyPrint: true}).then(function(result) { diff --git a/tests/test-data/underline.docx b/tests/test-data/underline.docx new file mode 100755 index 0000000..36604fc Binary files /dev/null and b/tests/test-data/underline.docx differ -- cgit v1.2.3