diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-07 21:37:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-07 21:37:21 +0100 |
| commit | bf37d9d321dad98f3fa2ca99a5235d07cb66892e (patch) | |
| tree | 46a51f532fba79a4cc19398e0aa4fda04b5debd4 /test/mammoth.tests.js | |
| parent | c0a14c171f5bdfda6cb76b1589a43ada3b5768ce (diff) | |
Wire up comment conversion code
Diffstat (limited to 'test/mammoth.tests.js')
| -rw-r--r-- | test/mammoth.tests.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js index 12bee96..0515b2a 100644 --- a/test/mammoth.tests.js +++ b/test/mammoth.tests.js @@ -269,6 +269,25 @@ describe('mammoth', function() { }); }); + test('when style mapping is defined for comment references then comments are included', function() { + var docxPath = path.join(__dirname, "test-data/comments.docx"); + var options = { + idPrefix: "doc-42-", + styleMap: "comment-reference => sup" + }; + return mammoth.convertToHtml({path: docxPath}, options).then(function(result) { + var expectedOutput = ( + '<p>Ouch' + + '<sup><a href="#doc-42-comment-0" id="doc-42-comment-ref-0">[MW1]</a></sup>.' + + '<sup><a href="#doc-42-comment-2" id="doc-42-comment-ref-2">[MW2]</a></sup></p>' + + '<dl><dt id="doc-42-comment-0">Comment [MW1]</dt><dd><p>A tachyon walks into a bar. <a href="#doc-42-comment-ref-0">↑</a></p></dd>' + + '<dt id="doc-42-comment-2">Comment [MW2]</dt><dd><p>Fin. <a href="#doc-42-comment-ref-2">↑</a></p></dd></dl>' + ); + assert.equal(result.value, expectedOutput); + assert.deepEqual(result.messages, []); + }); + }); + test('textboxes are read', function() { var docxPath = path.join(__dirname, "test-data/text-box.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { |
