diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:38:01 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:38:01 +0100 |
| commit | 2642cdd90f25528df0d9501200bc95417e60ec82 (patch) | |
| tree | 616d495bccaa000c550353412d648d6b56279f89 /tests/document-xml-reader.tests.js | |
| parent | cb18e8aa92108f8576c5d4312e89e6ddbabd88c8 (diff) | |
Add content-types to image elements
Diffstat (limited to 'tests/document-xml-reader.tests.js')
| -rw-r--r-- | tests/document-xml-reader.tests.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/document-xml-reader.tests.js b/tests/document-xml-reader.tests.js index 96b307d..75ce8d8 100644 --- a/tests/document-xml-reader.tests.js +++ b/tests/document-xml-reader.tests.js @@ -18,6 +18,12 @@ function readXmlElementValue(element) { return result.value; } +var fakeContentTypes = { + findContentType: function(path) { + return "<content-type: " + path + ">"; + } +}; + describe("readXmlElement: ", function() { test("paragraph has no style if it has no properties", function() { var paragraphXml = new XmlElement("w:p", {}, []); @@ -104,13 +110,13 @@ describe("readXmlElement: ", function() { relationshipId: "rId5", description: "It's a hat" }); - var imageBuffer = new Buffer("Not an image at all!"); var reader = new DocumentXmlReader( { "rId5": {target: "media/hat.png"} }, + fakeContentTypes, createFakeDocxFile({ "word/media/hat.png": imageBuffer }) @@ -120,9 +126,10 @@ describe("readXmlElement: ", function() { var element = single(result.value); assert.equal("image", element.type); assert.equal(element.altText, "It's a hat"); + assert.equal(element.contentType, "<content-type: word/media/hat.png>"); return element.read() .then(function(readValue) { - assert.equal(readValue, imageBuffer) + assert.equal(readValue, imageBuffer); }); }); @@ -147,6 +154,7 @@ describe("readXmlElement: ", function() { { "rId5": {target: "media/hat.png"} }, + fakeContentTypes, createFakeDocxFile({ "word/media/hat.png": imageBuffer }) |
