From 03293a8e2265dd84eb05a31b8100cf1a310c51bb Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 10 Jun 2014 15:22:36 +0100 Subject: Add basic footnote output --- tests/document-to-html.tests.js | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'tests') 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, '1'); + return converter.convertToHtml(footnoteReference).then(function(result) { + assert.equal(result.value, '1'); + }); + }); + + 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 = '

Knock knock1

' + + '
  1. Who\'s there?

'; + assert.equal(result.value, expectedOutput); }); }); -- cgit v1.2.3