diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-04-22 18:56:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-04-22 18:56:47 +0100 |
| commit | 782417f12f2fcfb157760c5ce6d435aac1f3fd62 (patch) | |
| tree | 70115de8d5d77449f634929cf7c116e43fb00323 /tests | |
| parent | 4f251acc131f57a4f160cb919a3cef9350215d01 (diff) | |
Show style name when emitted unknown paragraph style warning
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/document-to-html.tests.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index b69d0fb..dc70b58 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -62,12 +62,12 @@ describe('DocumentConverter', function() { test('uses style mappings to pick HTML element for docx paragraph', function() { var document = new documents.Document([ - paragraphOfText("Hello.", "Heading1"), + paragraphOfText("Hello.", "Heading1", "Heading 1"), ]); var converter = new DocumentConverter({ styleMap: [ { - from: documentMatchers.paragraph("Heading1"), + from: documentMatchers.paragraph({styleName: "Heading 1"}), to: htmlPaths.topLevelElement("h1") } ] @@ -96,22 +96,22 @@ describe('DocumentConverter', function() { test('warning is emitted if paragraph style is unrecognised', function() { var document = new documents.Document([ - paragraphOfText("Hello.", "Heading1"), + paragraphOfText("Hello.", "Heading1", "Heading 1"), ]); var converter = new DocumentConverter(); return converter.convertToHtml(document).then(function(result) { - assert.deepEqual(result.messages, [results.warning("Unrecognised paragraph style: Heading1")]); + assert.deepEqual(result.messages, [results.warning("Unrecognised paragraph style: 'Heading 1'")]); }); }); test('can use stacked styles to generate nested HTML elements', function() { var document = new documents.Document([ - paragraphOfText("Hello.", "Heading1") + paragraphOfText("Hello.") ]); var converter = new DocumentConverter({ styleMap: [ { - from: documentMatchers.paragraph("Heading1"), + from: documentMatchers.paragraph(), to: htmlPaths.elements(["h1", "span"]) } ] @@ -264,10 +264,11 @@ describe('DocumentConverter', function() { }); }); -function paragraphOfText(text, styleId) { +function paragraphOfText(text, styleId, styleName) { var run = runOfText(text); return new documents.Paragraph([run], { - styleId: styleId + styleId: styleId, + styleName: styleName }); } |
