aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-01-07 21:40:46 +0000
committerMichael Williamson <mike@zwobble.org>2014-01-07 21:40:46 +0000
commit705973a152a3b3c9a03e40100529fa9559c925ce (patch)
tree8f1383749f7cc58b30e27d2d7a3e5463d7923a26 /tests
parentd9d55dece1861bbbf08f3688254447992cf1957f (diff)
Pass a plain document into transformDocument
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth.tests.js15
1 files changed, 15 insertions, 0 deletions
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("<h1>Hello.</h1>", 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) {