diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-04-10 15:19:24 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-04-10 15:19:24 +0100 |
| commit | d4e6defd5a5f0bb6fd7e248e4e21ca838a461910 (patch) | |
| tree | 0d5457ee5430076f8b11fa1cacf0bda56dff5f3d /tests | |
| parent | 0201587bec80aac0c1dcbf12c50ea6d459321585 (diff) | |
Handle consecutive runs of text
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/html-writer.tests.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/html-writer.tests.js b/tests/html-writer.tests.js index c40cda4..c317544 100644 --- a/tests/html-writer.tests.js +++ b/tests/html-writer.tests.js @@ -26,6 +26,17 @@ describe('html-writer', function() { return assert.equal(writer.asString(), "<ul><li>One</li><li>Two</li></ul>"); }); + test('indents text if prettyPrint is true', function() { + var writer = htmlWriter.writer({prettyPrint: true}); + writer.open("p"); + writer.text("One"); + writer.close("p"); + writer.open("p"); + writer.text("Two"); + writer.close("p"); + return assert.equal(writer.asString(), "<p>\n One\n</p>\n<p>\n Two\n</p>"); + }); + test('indents element if prettyPrint is true', function() { var writer = htmlWriter.writer({prettyPrint: true}); writer.open("ul"); @@ -59,6 +70,24 @@ describe('html-writer', function() { return assert.equal(writer.asString(), "<p>\n One\n Two\n</p>"); }); + test('run of text has only one new line', function() { + var writer = htmlWriter.writer({prettyPrint: true}); + writer.open("p"); + writer.text("One"); + writer.text("Two"); + writer.close("p"); + return assert.equal(writer.asString(), "<p>\n OneTwo\n</p>"); + }); + + test('run of html has only one new line', function() { + var writer = htmlWriter.writer({prettyPrint: true}); + writer.open("p"); + writer.append("One"); + writer.append("Two"); + writer.close("p"); + return assert.equal(writer.asString(), "<p>\n OneTwo\n</p>"); + }); + test('self closing elements are indented', function() { var writer = htmlWriter.writer({prettyPrint: true}); writer.open("p"); |
