aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-08-19 21:33:14 +0100
committerMichael Williamson <mike@zwobble.org>2015-08-19 21:33:14 +0100
commita274a2f176303bfec529edecb8cc1773daf8ae31 (patch)
tree53deca4545f51a17335d96c143716aad7e12dae5 /tests
parent041ccdb2b378b233fab7d3c2688ee7875d9bcaa1 (diff)
Handle embedding a style map into a document that already has one
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/style-map.tests.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/docx/style-map.tests.js b/tests/docx/style-map.tests.js
index f1ac68d..fcf22ab 100644
--- a/tests/docx/style-map.tests.js
+++ b/tests/docx/style-map.tests.js
@@ -42,6 +42,28 @@ describe("style-map", function() {
});
});
});
+
+ test('re-embedding style map replaces original', function() {
+ var zip = normalDocx();
+
+ var expectedRelationshipsXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
+ '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' +
+ '<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>' +
+ '<Relationship Id="rMammothStyleMap" Type="http://schemas.zwobble.org/mammoth/style-map" Target="/mammoth/style-map"/>' +
+ '</Relationships>';
+
+ return styleMap.writeStyleMap(zip, "p => h1").then(function() {
+ return styleMap.writeStyleMap(zip, "p => h2");
+ }).then(function() {
+ return zip.read("word/_rels/document.xml.rels", "utf8").then(function(contents) {
+ assert.equal(contents, expectedRelationshipsXml);
+ });
+ }).then(function() {
+ return styleMap.readStyleMap(zip).then(function(contents) {
+ assert.equal(contents, "p => h2");
+ });
+ });
+ });
});
function normalDocx() {