diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-10-13 23:29:41 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-10-13 23:49:31 +0100 |
| commit | 7b7ce0d563ddc07172b0f241a5c3baf344f256e8 (patch) | |
| tree | 43f5fddf920d47e281a30139bde99da5a689d667 /tests/document-to-html.tests.js | |
| parent | e04d054a1b414e843fa6d6f5ee1ae75c0df533b1 (diff) | |
Collapse similar HTML elements
Diffstat (limited to 'tests/document-to-html.tests.js')
| -rw-r--r-- | tests/document-to-html.tests.js | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index 323efb6..7180191 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -9,6 +9,7 @@ var htmlPaths = require("../lib/html-paths"); var xml = require("../lib/xml"); var results = require("../lib/results"); var documentMatchers = require("../lib/document-matchers"); +var Html = require("../lib/html"); describe('DocumentConverter', function() { @@ -157,17 +158,16 @@ describe('DocumentConverter', function() { }); }); - // TODO - //~ test('consecutive bold runs are wrapped in a single <strong> element', function() { - //~ var paragraph = new documents.Paragraph([ - //~ runOfText("Hello", {isBold: true}), - //~ runOfText(".", {isBold: true}) - //~ ]); - //~ var converter = new DocumentConverter(); - //~ return converter.convertToHtml(paragraph).then(function(result) { - //~ assert.equal(result.value, "<p><strong>Hello.</strong></p>"); - //~ }); - //~ }); + test('consecutive bold runs are wrapped in a single <strong> element', function() { + var paragraph = new documents.Paragraph([ + runOfText("Hello", {isBold: true}), + runOfText(".", {isBold: true}) + ]); + var converter = new DocumentConverter(); + return converter.convertToHtml(paragraph).then(function(result) { + assert.equal(result.value, "<p><strong>Hello.</strong></p>"); + }); + }); test('underline runs are ignored by default', function() { var run = runOfText("Hello.", {isUnderline: true}); @@ -476,10 +476,9 @@ describe('DocumentConverter', function() { contentType: "image/png" }); var converter = new DocumentConverter({ - convertImage: function(element, html, messages, callback) { + convertImage: function(element, messages, callback) { element.read("utf8").then(function(altText) { - html.selfClosing(htmlPaths.element("img", {alt: altText})); - callback(); + callback(null, Html.selfClosingElement("img", {alt: altText})); }); } }); |
