diff options
| -rw-r--r-- | lib/document-to-html.js | 2 | ||||
| -rw-r--r-- | tests/document-to-html.tests.js | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js index ab02b64..cb5ec16 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -119,7 +119,7 @@ function DocumentConversion(options) { result = wrapInNonFreshElement(result, "sup"); } if (run.isItalic) { - result = wrapInNonFreshElement(result, "em"); + result = convertRunProperty(result, "italic", "em"); } if (run.isBold) { result = convertRunProperty(result, "bold", "strong"); diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index 779c584..2b23613 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -263,6 +263,21 @@ describe('DocumentConverter', function() { }); }); + test('italic runs can be configured with style mapping', function() { + var run = runOfText("Hello.", {isItalic: true}); + var converter = new DocumentConverter({ + styleMap: [ + { + from: documentMatchers.italic, + to: htmlPaths.elements([htmlPaths.element("strong")]) + } + ] + }); + return converter.convertToHtml(run).then(function(result) { + assert.equal(result.value, "<strong>Hello.</strong>"); + }); + }); + test('run can be both bold and italic', function() { var run = runOfText("Hello.", {isBold: true, isItalic: true}); var converter = new DocumentConverter(); |
