diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-05-17 16:20:43 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-05-17 16:20:43 +0100 |
| commit | fc5b5a22f9b9be138da18d38a67224171663c2f9 (patch) | |
| tree | 1eeba35c07a1713908f0935cdc3c8c4e903541fd /tests | |
| parent | 969d80c62e7d5d5ed41a3dc7ec8f5f8bdec59a91 (diff) | |
Add ignoreEmptyParagraphs option
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mammoth.tests.js | 16 | ||||
| -rw-r--r-- | tests/test-data/empty.docx | bin | 0 -> 3306 bytes |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 247ef17..6395afd 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -40,6 +40,22 @@ describe('mammoth', function() { }); }); + test('empty paragraphs are ignored by default', function() { + var docxPath = path.join(__dirname, "test-data/empty.docx"); + return mammoth.convertToHtml({path: docxPath}).then(function(result) { + assert.equal(result.value, ""); + assert.deepEqual(result.messages, []); + }); + }); + + test('empty paragraphs are preserved if ignoreEmptyParagraphs is false', function() { + var docxPath = path.join(__dirname, "test-data/empty.docx"); + return mammoth.convertToHtml({path: docxPath}, {ignoreEmptyParagraphs: false}).then(function(result) { + assert.equal(result.value, "<p></p>"); + assert.deepEqual(result.messages, []); + }); + }); + test('style map can be expressed as string', function() { var docxFile = createFakeDocxFile({ "word/document.xml": testData("simple/word/document.xml") diff --git a/tests/test-data/empty.docx b/tests/test-data/empty.docx Binary files differnew file mode 100644 index 0000000..e10b869 --- /dev/null +++ b/tests/test-data/empty.docx |
