diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-06-17 14:16:00 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-06-17 14:16:00 +0100 |
| commit | dc31bacddd43e100a2793c76e26d35568262d89a (patch) | |
| tree | c1716318bee771cddb0b56d95b560934d489ed4f | |
| parent | 11a26283165edf9e05b514da9141c28c48254b56 (diff) | |
Add end-to-end tests for underline handling
| -rw-r--r-- | tests/mammoth.tests.js | 14 | ||||
| -rwxr-xr-x | tests/test-data/underline.docx | bin | 0 -> 12797 bytes |
2 files changed, 14 insertions, 0 deletions
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, '<p><strong>The </strong><strong>Sunset</strong><strong> Tree</strong></p>'); + }); + }); + + 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, '<p><strong>The </strong><strong><em>Sunset</em></strong><strong> Tree</strong></p>'); + }); + }); + 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 Binary files differnew file mode 100755 index 0000000..36604fc --- /dev/null +++ b/tests/test-data/underline.docx |
