From b0ff9fc6b25bbe74aaa7245d24a6476b4f5f1ec6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 Jul 2016 20:49:22 +0100 Subject: Test that comments are ignored by default --- lib/documents.js | 6 +++--- test/document-to-html.tests.js | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/documents.js b/lib/documents.js index d4a28af..9f01d88 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -181,9 +181,9 @@ function BookmarkStart(options) { }; } -exports.Document = Document; -exports.Paragraph = Paragraph; -exports.Run = Run; +exports.document = exports.Document = Document; +exports.paragraph = exports.Paragraph = Paragraph; +exports.run = exports.Run = Run; exports.Text = Text; exports.Tab = Tab; exports.Hyperlink = Hyperlink; diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index 0b4f905..a4678ec 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -486,6 +486,26 @@ describe('DocumentConverter', function() { }); }); + test('comments are ignored by default', function() { + var reference = documents.commentReference("4"); + var comment = documents.comment({ + commentId: "4", + body: [paragraphOfText("Who's there?")] + }); + var document = documents.document([ + documents.paragraph([ + runOfText("Knock knock"), + documents.run([reference]) + ]) + ], {comments: [comment]}); + + var converter = new DocumentConverter({}); + return converter.convertToHtml(document).then(function(result) { + assert.equal(result.value, '

Knock knock

'); + }); + + }); + test('images are written with data URIs', function() { var imageBuffer = new Buffer("Not an image at all!"); var image = new documents.Image({ -- cgit v1.2.3