From 705973a152a3b3c9a03e40100529fa9559c925ce Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 7 Jan 2014 21:40:46 +0000 Subject: Pass a plain document into transformDocument --- tests/mammoth.tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index f0d87c8..08270a4 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -59,6 +59,21 @@ describe('mammoth', function() { }); }); + test('options.transformDocument is used to transform document if set', function() { + var docxFile = createFakeDocxFile({ + "word/document.xml": testData("simple/word/document.xml") + }); + var options = { + transformDocument: function(document) { + document.children[0].styleName = "Heading1"; + return document; + } + }; + return mammoth.convertToHtml({file: docxFile}, options).then(function(result) { + assert.equal("

Hello.

", result.value); + }); + }); + test('inline images are included in output', function() { var docxPath = path.join(__dirname, "test-data/tiny-picture.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { -- cgit v1.2.3