diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-03-29 20:31:19 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-03-29 20:31:19 +0000 |
| commit | 15aaddae7a7e2dd8d369b514218778931a1543e0 (patch) | |
| tree | 3564634c61e53dfa15f82f02757c289da988ce3f /tests/documents.tests.js | |
| parent | 12aa4a332cf40f5aab393bc7eafc2020945ea9f4 (diff) | |
Convert XML into simple document elements
Diffstat (limited to 'tests/documents.tests.js')
| -rw-r--r-- | tests/documents.tests.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/documents.tests.js b/tests/documents.tests.js new file mode 100644 index 0000000..7d2b5b4 --- /dev/null +++ b/tests/documents.tests.js @@ -0,0 +1,28 @@ +var assert = require("assert"); + +var documents = require("../lib/documents"); +var DocumentConverter = documents.DocumentConverter; +var test = require("./testing").test; + + +describe('DocumentConverter', function() { + test('should convert document containing one paragraph to single p element', function() { + var document = new documents.Document([ + paragraphOfText("Hello.") + ]); + var converter = new DocumentConverter(); + return converter.convertToHtml(document).then(function(result) { + assert.equal("<p>Hello.</p>", result.html); + }); + }) +}); + +function paragraphOfText(text) { + var run = runOfText(text); + return new documents.Paragraph([run]); +} + +function runOfText(text) { + var textElement = new documents.Text(text); + return new documents.Run([textElement]); +} |
