aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-12-06 15:44:56 +0000
committerMichael Williamson <mike@zwobble.org>2015-12-06 15:44:56 +0000
commitaf8b26e0e157fe41673094622dc0988ddc3e70d5 (patch)
tree3ec4bddf55d02f26956445934135fa9f522cb8ae /tests
parent9878af20ba8c637853308323dab3e06c8ebbfed4 (diff)
Read v:imagedata with r:id attribute
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/body-reader.tests.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/docx/body-reader.tests.js b/tests/docx/body-reader.tests.js
index 2e85d76..895f29e 100644
--- a/tests/docx/body-reader.tests.js
+++ b/tests/docx/body-reader.tests.js
@@ -284,6 +284,31 @@ describe("readXmlElement: ", function() {
assert.deepEqual(result.value, []);
});
+ test("can read imagedata elements with r:id attribute", function() {
+ var imagedataElement = new XmlElement("v:imagedata", {"r:id": "rId5", "o:title": "It's a hat"});
+
+ var imageBuffer = new Buffer("Not an image at all!");
+ var reader = new BodyReader({
+ relationships: {
+ "rId5": {target: "media/hat.png"}
+ },
+ contentTypes: fakeContentTypes,
+ docxFile: createFakeDocxFile({
+ "word/media/hat.png": imageBuffer
+ })
+ });
+ var result = reader.readXmlElement(imagedataElement);
+ assert.deepEqual(result.messages, []);
+ var element = result.value;
+ assert.equal("image", element.type);
+ assert.equal(element.altText, "It's a hat");
+ assert.equal(element.contentType, "image/png");
+ return element.read()
+ .then(function(readValue) {
+ assert.equal(readValue, imageBuffer);
+ });
+ });
+
test("can read inline pictures", function() {
var drawing = createInlineImage({
blip: createEmbeddedBlip("rId5"),