aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-01-19 23:05:45 +0000
committerMichael Williamson <mike@zwobble.org>2015-01-19 23:05:45 +0000
commit965bd9513da033b9804af8ec29c7fa609a84512c (patch)
tree28027622b24a00bb44fd4a1e9c91462493d78989 /tests
parent58cae6030e51481ffb462e52ab6aeb479e0a705d (diff)
Add support for endnotes
Diffstat (limited to 'tests')
-rw-r--r--tests/document-to-html.tests.js10
-rw-r--r--tests/docx/document-xml-reader.tests.js2
-rw-r--r--tests/mammoth.tests.js9
-rw-r--r--tests/test-data/endnotes.docxbin4253 -> 4431 bytes
4 files changed, 11 insertions, 10 deletions
diff --git a/tests/document-to-html.tests.js b/tests/document-to-html.tests.js
index a5cf294..63b445d 100644
--- a/tests/document-to-html.tests.js
+++ b/tests/document-to-html.tests.js
@@ -285,8 +285,9 @@ describe('DocumentConverter', function() {
});
test('footnote reference is converted to superscript intra-page link', function() {
- var footnoteReference = new documents.FootnoteReference({
- footnoteId: "4"
+ var footnoteReference = new documents.NoteReference({
+ noteType: "footnote",
+ noteId: "4"
});
var converter = new DocumentConverter({
generateUniquifier: function() { return 42; }
@@ -297,8 +298,9 @@ describe('DocumentConverter', function() {
});
test('footnotes are included after the main body', function() {
- var footnoteReference = new documents.FootnoteReference({
- footnoteId: "4"
+ var footnoteReference = new documents.NoteReference({
+ noteType: "footnote",
+ noteId: "4"
});
var document = new documents.Document(
[new documents.Paragraph([
diff --git a/tests/docx/document-xml-reader.tests.js b/tests/docx/document-xml-reader.tests.js
index 778bf06..86c0fcb 100644
--- a/tests/docx/document-xml-reader.tests.js
+++ b/tests/docx/document-xml-reader.tests.js
@@ -361,7 +361,7 @@ describe("convertXmlToDocument: ", function() {
var documentXml = new XmlElement("w:document", {}, [bodyXml]);
var document = convertXmlToDocumentValue({root: documentXml}, {footnotes: footnotes});
- var footnote = document.notes.findFootnoteById("4");
+ var footnote = document.notes.resolve({noteType: "footnote", noteId: "4"});
assert.deepEqual(footnote.id, "4");
assert.deepEqual(footnote.body[0].type, "paragraph");
});
diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js
index 08649f4..08eafa4 100644
--- a/tests/mammoth.tests.js
+++ b/tests/mammoth.tests.js
@@ -165,17 +165,16 @@ describe('mammoth', function() {
});
test('endnotes are appended to text', function() {
- return;
var docxPath = path.join(__dirname, "test-data/endnotes.docx");
var options = {
generateUniquifier: function() { return 42; }
};
return mammoth.convertToHtml({path: docxPath}, options).then(function(result) {
var expectedOutput = '<p>Ouch' +
- '<sup><a href="#endnote-42-1" id="endnote-ref-42-1">[1]</a></sup>.' +
- '<sup><a href="#endnote-42-2" id="endnote-ref-42-2">[2]</a></sup></p>' +
- '<ol><li id="endnote-42-1"><p> A tachyon walks into a bar. <a href="#endnote-ref-42-1">↑</a></p></li>' +
- '<li id="endnote-42-2"><p> Fin. <a href="#endnote-ref-42-2">↑</a></p></li></ol>';
+ '<sup><a href="#endnote-42-2" id="endnote-ref-42-2">[1]</a></sup>.' +
+ '<sup><a href="#endnote-42-3" id="endnote-ref-42-3">[2]</a></sup></p>' +
+ '<ol><li id="endnote-42-2"><p> A tachyon walks into a bar. <a href="#endnote-ref-42-2">↑</a></p></li>' +
+ '<li id="endnote-42-3"><p> Fin. <a href="#endnote-ref-42-3">↑</a></p></li></ol>';
assert.equal(result.value, expectedOutput);
// TODO: get rid of warnings
//~ assert.deepEqual(result.messages, []);
diff --git a/tests/test-data/endnotes.docx b/tests/test-data/endnotes.docx
index 5ec7faf..1ae4f93 100644
--- a/tests/test-data/endnotes.docx
+++ b/tests/test-data/endnotes.docx
Binary files differ