aboutsummaryrefslogtreecommitdiff
path: root/tests/documents.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-03-29 20:42:38 +0000
committerMichael Williamson <mike@zwobble.org>2013-03-29 20:42:38 +0000
commite3891290bd3034d0ce8034387ffab1e5a9793a70 (patch)
tree3e9ba68c93ac030c34aaee66a5929815cf037c21 /tests/documents.tests.js
parent59421d9ef6d1521f19b83a8409934682592ccae6 (diff)
Add basic style mappings for paragraphs
Diffstat (limited to 'tests/documents.tests.js')
-rw-r--r--tests/documents.tests.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/documents.tests.js b/tests/documents.tests.js
index 76f237e..a5e81af 100644
--- a/tests/documents.tests.js
+++ b/tests/documents.tests.js
@@ -14,7 +14,7 @@ describe('DocumentConverter', function() {
return converter.convertToHtml(document).then(function(result) {
assert.equal("<p>Hello.</p>", result.html);
});
- })
+ });
test('should convert document containing multiple paragraphs to multiple p elements', function() {
var document = new documents.Document([
@@ -25,12 +25,28 @@ describe('DocumentConverter', function() {
return converter.convertToHtml(document).then(function(result) {
assert.equal("<p>Hello.</p><p>Goodbye.</p>", result.html);
});
- })
+ });
+
+ test('uses style mappings to pick HTML element for docx paragraph', function() {
+ var document = new documents.Document([
+ paragraphOfText("Hello.", "Heading1"),
+ ]);
+ var converter = new DocumentConverter({
+ paragraphStyleMap: {
+ "Heading1": "h1"
+ }
+ });
+ return converter.convertToHtml(document).then(function(result) {
+ assert.equal("<h1>Hello.</h1>", result.html);
+ });
+ });
});
-function paragraphOfText(text) {
+function paragraphOfText(text, styleName) {
var run = runOfText(text);
- return new documents.Paragraph([run]);
+ return new documents.Paragraph([run], {
+ styleName: styleName
+ });
}
function runOfText(text) {