aboutsummaryrefslogtreecommitdiff
path: root/test/mammoth.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-01-23 20:05:52 +0000
committerMichael Williamson <mike@zwobble.org>2017-01-23 20:05:52 +0000
commit1e85fcd0539d71484a4b5f44e1f0ccd0f48a90ec (patch)
tree45e2cf1240322538537ba9c7d5caad59bfe3b016 /test/mammoth.tests.js
parentec6ea86c93595e9f2e6b41e4e0b60891f14a325d (diff)
Add test for base-relative targets
Diffstat (limited to 'test/mammoth.tests.js')
-rw-r--r--test/mammoth.tests.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js
index 43b4fe3..2dbdbe4 100644
--- a/test/mammoth.tests.js
+++ b/test/mammoth.tests.js
@@ -205,13 +205,20 @@ test('mammoth.transforms.paragraph only transforms paragraphs', function() {
});
});
-test('inline images are included in output', function() {
+test('inline images referenced by path relative to part are included in output', function() {
var docxPath = path.join(__dirname, "test-data/tiny-picture.docx");
return mammoth.convertToHtml({path: docxPath}).then(function(result) {
assert.equal(result.value, '<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=" /></p>');
});
});
+test('inline images referenced by path relative to base are included in output', function() {
+ var docxPath = path.join(__dirname, "test-data/tiny-picture-target-base-relative.docx");
+ return mammoth.convertToHtml({path: docxPath}).then(function(result) {
+ assert.equal(result.value, '<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=" /></p>');
+ });
+});
+
test('src of inline images can be changed', function() {
var docxPath = path.join(__dirname, "test-data/tiny-picture.docx");
var convertImage = mammoth.images.imgElement(function(element) {