aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-08-12 21:32:41 +0100
committerMichael Williamson <mike@zwobble.org>2015-08-12 21:32:41 +0100
commit5f5217a4e16f7be697b24a46cf58e47753967d95 (patch)
tree5fa3113cf65ee3e3c554060b54a86cfe954f0a19 /tests
parentf71f3ea07839011e2fd60402069917e4fc2bed93 (diff)
Initial support for writing style maps to docx files
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth.tests.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index ad7a058..41a3a22 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -80,6 +80,21 @@ describe('mammoth', function() {
});
});
+ test('style map can be saved and read from document buffer', function() {
+ var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+ return promises.nfcall(fs.readFile, docxPath)
+ .then(function(buffer) {
+ return mammoth.writeStyleMapToDocx({buffer: buffer, styleMap: "p => h1"});
+ })
+ .then(function(docx) {
+ return mammoth.convertToHtml({buffer: docx.toBuffer()});
+ })
+ .then(function(result) {
+ assert.equal(result.value, "<h1>Walking on imported air</h1>");
+ assert.deepEqual(result.messages, []);
+ });
+ });
+
test('options are passed to document converter when calling mammoth.convertToHtml', function() {
var docxFile = createFakeDocxFile({
"word/document.xml": testData("simple/word/document.xml")