From a274a2f176303bfec529edecb8cc1773daf8ae31 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 19 Aug 2015 21:33:14 +0100 Subject: Handle embedding a style map into a document that already has one --- tests/docx/style-map.tests.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') 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 = '' + + '' + + '' + + '' + + ''; + + 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() { -- cgit v1.2.3