aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/document-xml-reader.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-06-10 16:23:15 +0100
committerMichael Williamson <mike@zwobble.org>2014-06-10 16:23:15 +0100
commit8aec6e713d08a532194b50591fa338ecb9a251f9 (patch)
tree00004b0324527dac50add38cdf6ac39cec604227 /tests/docx/document-xml-reader.tests.js
parentee2fc5da880df5f9ea8cdaebc506d130c3009ce3 (diff)
Basic support for footnotes
Diffstat (limited to 'tests/docx/document-xml-reader.tests.js')
-rw-r--r--tests/docx/document-xml-reader.tests.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/docx/document-xml-reader.tests.js b/tests/docx/document-xml-reader.tests.js
index af43c16..6659735 100644
--- a/tests/docx/document-xml-reader.tests.js
+++ b/tests/docx/document-xml-reader.tests.js
@@ -21,6 +21,14 @@ function readXmlElementValue(element, options) {
return result.value;
}
+function convertXmlToDocumentValue(element, options) {
+ options = options || {};
+ var reader = new DocumentXmlReader(options);
+ var result = reader.convertXmlToDocument(element, options);
+ assert.deepEqual(result.messages, []);
+ return result.value;
+}
+
var fakeContentTypes = {
findContentType: function(path) {
return "<content-type: " + path + ">";
@@ -280,6 +288,21 @@ describe("readXmlElement: ", function() {
var result = readXmlElement(hyperlinkXml);
assert.deepEqual(result.value[0].type, "run");
});
+
+});
+
+describe("convertXmlToDocument: ", function() {
+
+ test("footnotes of document are read", function() {
+ var paragraphXml = new XmlElement("w:p", {}, []);
+ var bodyXml = new XmlElement("w:body", {}, [paragraphXml]);
+ var documentXml = new XmlElement("w:document", {}, [bodyXml]);
+ var footnotes = [{id: "4", body: [paragraphXml]}];
+ var document = convertXmlToDocumentValue({root: documentXml}, {footnotes: footnotes});
+ var footnote = document.footnotes.findFootnoteById("4");
+ assert.deepEqual(footnote.id, "4");
+ assert.deepEqual(footnote.body[0].type, "paragraph");
+ });
});
function runWithProperties(children) {