From 33f089bb9f1d8fa599fe10ba1ddead6c10dbd4b4 Mon Sep 17 00:00:00 2001 From: vgmoose Date: Fri, 21 Jul 2017 00:04:49 -0400 Subject: Rename smallCaps style mapping to small-caps --- test/document-to-html.tests.js | 24 ++++++++++++++++++++++++ test/style-reader.tests.js | 16 ++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/document-to-html.tests.js b/test/document-to-html.tests.js index bf6631f..861033b 100644 --- a/test/document-to-html.tests.js +++ b/test/document-to-html.tests.js @@ -296,6 +296,30 @@ test('subscript runs are wrapped in tags', function() { }); }); +test('small caps runs are ignored by default', function() { + var run = runOfText("Hello.", {isSmallCaps: true}); + var converter = new DocumentConverter(); + return converter.convertToHtml(run).then(function(result) { + assert.equal(result.value, "Hello."); + }); +}); + +test('small caps runs can be configured with style mapping', function() { + var run = runOfText("Hello.", {isSmallCaps: true}); + var converter = new DocumentConverter({ + styleMap: [ + { + from: documentMatchers.smallCaps, + to: htmlPaths.elements([htmlPaths.element("span")]) + } + ] + }); + return converter.convertToHtml(run).then(function(result) { + assert.equal(result.value, "Hello."); + }); +}); + + test('run styles are converted to HTML if mapping exists', function() { var run = runOfText("Hello.", {styleId: "Heading1Char", styleName: "Heading 1 Char"}); var converter = new DocumentConverter({ diff --git a/test/style-reader.tests.js b/test/style-reader.tests.js index 2ae7385..20d4127 100644 --- a/test/style-reader.tests.js +++ b/test/style-reader.tests.js @@ -159,6 +159,13 @@ test("styleReader.readDocumentMatcher", { ); }, + "reads smallcaps": function() { + assertDocumentMatcher( + "small-caps", + documentMatchers.smallCaps + ); + }, + "reads comment-reference": function() { assertDocumentMatcher( "comment-reference", @@ -185,15 +192,8 @@ test("styleReader.readDocumentMatcher", { "br[type='column']", documentMatchers.columnBreak ); - }, - - "reads smallcaps": function() { - assertDocumentMatcher( - "smallCaps", - documentMatchers.smallCaps - ); } - + }); function assertDocumentMatcher(input, expected) { -- cgit v1.2.3