diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:22:36 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:22:36 +0100 |
| commit | 03293a8e2265dd84eb05a31b8100cf1a310c51bb (patch) | |
| tree | 4d87de615c8fcd81ebeb88b4e1f29d79568ebce5 /tests | |
| parent | 8be57d82ffae15aa753ca57ce19c581bf0d6b897 (diff) | |
Add basic footnote output
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/document-to-html.tests.js | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js index aae8499..9a40c88 100644 --- a/tests/document-to-html.tests.js +++ b/tests/document-to-html.tests.js @@ -198,10 +198,38 @@ describe('DocumentConverter', function() { }); test('footnote reference is converted to superscript intra-page link', function() { - var tab = new documents.FootnoteReference({id: 4, body: paragraphOfText("Hello.")}); + var footnoteReference = new documents.FootnoteReference({ + footnoteNumber: 1, + body: paragraphOfText("Who's there?") + }); var converter = new DocumentConverter(); - return converter.convertToHtml(tab).then(function(result) { - assert.equal(result.value, '<sup><a href="#footnote-4">1</a></sup>'); + return converter.convertToHtml(footnoteReference).then(function(result) { + assert.equal(result.value, '<sup><a href="#footnote-1">1</a></sup>'); + }); + }); + + test('footnotes are included after the main body', function() { + var footnoteReference = new documents.FootnoteReference({ + footnoteNumber: 1 + }); + var document = new documents.Document( + [new documents.Paragraph([ + runOfText("Knock knock"), + new documents.Run([footnoteReference]) + ])], + { + footnotes: [documents.Footnote({ + body: [paragraphOfText("Who's there?")], + footnoteNumber: 1 + })] + } + ); + + var converter = new DocumentConverter(); + return converter.convertToHtml(document).then(function(result) { + var expectedOutput = '<p>Knock knock<sup><a href="#footnote-1">1</a></sup></p>' + + '<ol><li id="footnote-1"><p>Who\'s there?</p></li></ol>'; + assert.equal(result.value, expectedOutput); }); }); |
