From 5ea0765a0699c2d007a9e53da60b3121e53ff50e Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 8 Jul 2014 10:37:20 +0100 Subject: Expose images module in index.js and test --- tests/mammoth.tests.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 23e6c95..b6fafaa 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -76,6 +76,18 @@ describe('mammoth', function() { }); }); + test('src of inline images can be changed', function() { + var docxPath = path.join(__dirname, "test-data/tiny-picture.docx"); + var convertImage = mammoth.images.inline(function(element) { + return element.read("base64").then(function(encodedImage) { + return {src: encodedImage.substring(0, 2) + "," + element.contentType}; + }); + }); + return mammoth.convertToHtml({path: docxPath}, {convertImage: convertImage}).then(function(result) { + assert.equal(result.value, '

'); + }); + }); + test('simple list is converted to list elements', function() { var docxPath = path.join(__dirname, "test-data/simple-list.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { -- cgit v1.2.3