diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-01 12:55:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-01 12:55:21 +0100 |
| commit | ad75779025dd2fdae2eab851e1be1c6e5b8955ef (patch) | |
| tree | 087f2c0d5db242347096c05808ece9f340f4f94a /tests/documents.tests.js | |
| parent | c9f133942a541fbcae95720b5b0480b94e36c00f (diff) | |
Generate HTML for bold elements
Diffstat (limited to 'tests/documents.tests.js')
| -rw-r--r-- | tests/documents.tests.js | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/documents.tests.js b/tests/documents.tests.js index 06faf10..9cd3a49 100644 --- a/tests/documents.tests.js +++ b/tests/documents.tests.js @@ -13,7 +13,7 @@ describe('DocumentConverter', function() { ]); var converter = new DocumentConverter(); return converter.convertToHtml(document).then(function(result) { - assert.equal("<p>Hello.</p>", result.html); + assert.equal(result.html, "<p>Hello.</p>"); }); }); @@ -33,7 +33,7 @@ describe('DocumentConverter', function() { ]); var converter = new DocumentConverter({defaultParagraphStyle: styles.topLevelElement("h1")}); return converter.convertToHtml(document).then(function(result) { - assert.equal("<h1>Hello.</h1>", result.html); + assert.equal(result.html, "<h1>Hello.</h1>"); }); }); @@ -43,7 +43,7 @@ describe('DocumentConverter', function() { ]); var converter = new DocumentConverter(); return converter.convertToHtml(document).then(function(result) { - assert.equal("<p>1 < 2</p>", result.html); + assert.equal(result.html, "<p>1 < 2</p>"); }); }); @@ -54,7 +54,7 @@ describe('DocumentConverter', function() { ]); var converter = new DocumentConverter(); return converter.convertToHtml(document).then(function(result) { - assert.equal("<p>Hello.</p><p>Goodbye.</p>", result.html); + assert.equal(result.html, "<p>Hello.</p><p>Goodbye.</p>"); }); }); @@ -68,7 +68,7 @@ describe('DocumentConverter', function() { } }); return converter.convertToHtml(document).then(function(result) { - assert.equal("<h1>Hello.</h1>", result.html); + assert.equal(result.html, "<h1>Hello.</h1>"); }); }); @@ -82,7 +82,25 @@ describe('DocumentConverter', function() { } }); return converter.convertToHtml(document).then(function(result) { - assert.equal("<h1><span>Hello.</span></h1>", result.html); + assert.equal(result.html, "<h1><span>Hello.</span></h1>"); + }); + }); + + test('bold runs are wrapped in <strong> tags', function() { + var run = runOfText("Hello.", {isBold: true}); + var converter = new DocumentConverter(); + return converter.convertToHtml(run).then(function(result) { + assert.equal(result.html, "<strong>Hello.</strong>"); + }); + }); + + test('bold runs can exist inside other tags', function() { + var run = new documents.Paragraph([ + runOfText("Hello.", {isBold: true}) + ]); + var converter = new DocumentConverter(); + return converter.convertToHtml(run).then(function(result) { + assert.equal(result.html, "<p><strong>Hello.</strong></p>"); }); }); }); @@ -94,7 +112,7 @@ function paragraphOfText(text, styleName) { }); } -function runOfText(text) { +function runOfText(text, properties) { var textElement = new documents.Text(text); - return new documents.Run([textElement]); + return new documents.Run([textElement], properties); } |
