aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-07-08 10:37:20 +0100
committerMichael Williamson <mike@zwobble.org>2014-07-08 10:37:20 +0100
commit5ea0765a0699c2d007a9e53da60b3121e53ff50e (patch)
treee5f2c562b0d4287be112b0274e8e1db8526e6043 /tests
parent2c4aa37562fbc0b8410efba6782b0c9f2ade6e7b (diff)
Expose images module in index.js and test
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth.tests.js12
1 files changed, 12 insertions, 0 deletions
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, '<p><img src="iV,image/png" /></p>');
+ });
+ });
+
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) {