aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-06-10 15:40:05 +0100
committerMichael Williamson <mike@zwobble.org>2014-06-10 15:40:05 +0100
commit296ac78496e4d94dafd1a4f6f872a1283b796318 (patch)
tree1d30666e971e63a5bf0e4008bf1a0abacde3d0be /tests
parent88b21ba0d0989a5c4f142f5971d33b069a7dfb26 (diff)
Pass all footnotes into document object
Diffstat (limited to 'tests')
-rw-r--r--tests/document-to-html.tests.js18
-rw-r--r--tests/mammoth.tests.js1
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js
index f030a72..da9879e 100644
--- a/tests/document-to-html.tests.js
+++ b/tests/document-to-html.tests.js
@@ -199,7 +199,7 @@ describe('DocumentConverter', function() {
test('footnote reference is converted to superscript intra-page link', function() {
var footnoteReference = new documents.FootnoteReference({
- footnoteId: 4,
+ footnoteId: "4",
body: paragraphOfText("Who's there?")
});
var converter = new DocumentConverter();
@@ -210,7 +210,7 @@ describe('DocumentConverter', function() {
test('footnotes are included after the main body', function() {
var footnoteReference = new documents.FootnoteReference({
- footnoteId: 1
+ footnoteId: "4"
});
var document = new documents.Document(
[new documents.Paragraph([
@@ -218,17 +218,19 @@ describe('DocumentConverter', function() {
new documents.Run([footnoteReference])
])],
{
- footnotes: [documents.Footnote({
- body: [paragraphOfText("Who's there?")],
- id: 1
- })]
+ footnotes: new documents.Footnotes({
+ 4: new documents.Footnote({
+ id: "4",
+ body: [paragraphOfText("Who's there?")]
+ })
+ })
}
);
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>';
+ var expectedOutput = '<p>Knock knock<sup><a href="#footnote-4">1</a></sup></p>' +
+ '<ol><li id="footnote-4"><p>Who\'s there?</p></li></ol>';
assert.equal(result.value, expectedOutput);
});
});
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 093173e..dd0f5b7 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -91,6 +91,7 @@ describe('mammoth', function() {
test('footnotes are appended to text', function() {
// TODO: generate unique IDs for footnotes
// TODO: generate links back to main body
+ // TODO: don't duplicate footnotes with multiple references
// TODO: not yet implemented
return;
var docxPath = path.join(__dirname, "test-data/footnotes.docx");