From baf9808eae3441de70a00cd043e10e0ebf06b7c0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 Jul 2016 20:44:20 +0100 Subject: Add HTML path for ignoring elements --- test/mammoth.tests.js | 6 +++--- test/style-reader.tests.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js index 1a82014..12bee96 100644 --- a/test/mammoth.tests.js +++ b/test/mammoth.tests.js @@ -114,12 +114,12 @@ describe('mammoth', function() { test('warning if style mapping is not understood', function() { var docxPath = path.join(__dirname, "test-data/single-paragraph.docx"); var options = { - styleMap: "!!!!\np => h1" + styleMap: "????\np => h1" }; return mammoth.convertToHtml({path: docxPath}, options).then(function(result) { assert.equal("

Walking on imported air

", result.value); - var warning = "Did not understand this style mapping, so ignored it: !!!!\n" + - 'Error was at character number 1: Expected element type but got unrecognisedCharacter "!"'; + var warning = "Did not understand this style mapping, so ignored it: ????\n" + + 'Error was at character number 1: Expected element type but got unrecognisedCharacter "?"'; assert.deepEqual(result.messages, [results.warning(warning)]); }); }); diff --git a/test/style-reader.tests.js b/test/style-reader.tests.js index 7265e8f..46a9fa1 100644 --- a/test/style-reader.tests.js +++ b/test/style-reader.tests.js @@ -54,6 +54,10 @@ describe('styleReader.readHtmlPath', function() { assertHtmlPath("p:fresh", expected); }); + test('reads ignore element', function() { + assertHtmlPath("!", htmlPaths.ignore); + }); + function assertHtmlPath(input, expected) { assert.deepEqual(readHtmlPath(input), results.success(expected)); } -- cgit v1.2.3