diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-01-21 17:43:32 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-01-21 17:43:32 +0000 |
| commit | 2f769b5dc8cc50a4199d356d1d55cd095420a225 (patch) | |
| tree | 96b4c11b0139b05a56ad97fc1b375db63a482bf7 /tests/docx/notes-reader.tests.js | |
| parent | 7b74fa3f81588a16f81d8c2b4269ad21705333c0 (diff) | |
Rename footnotes-reader.tests to notes-reader.tests
Diffstat (limited to 'tests/docx/notes-reader.tests.js')
| -rw-r--r-- | tests/docx/notes-reader.tests.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/docx/notes-reader.tests.js b/tests/docx/notes-reader.tests.js new file mode 100644 index 0000000..d3226f8 --- /dev/null +++ b/tests/docx/notes-reader.tests.js @@ -0,0 +1,36 @@ +var assert = require("assert"); + +var readFootnotesXml = require("../../lib/docx/notes-reader").readFootnotesXml; +var XmlElement = require("../../lib/xmlreader").Element; +var test = require("../testing").test; + + +describe('readFootnotesXml', function() { + test('ID and body of footnote are read', function() { + var footnoteBody = [new XmlElement("w:p", {}, [])]; + var footnotes = readFootnotesXml({ + root: new XmlElement("w:footnotes", {}, [ + new XmlElement("w:footnote", {"w:id": "1"}, footnoteBody) + ]) + }); + assert.equal(footnotes.length, 1); + assert.strictEqual(footnotes[0].body, footnoteBody); + assert.deepEqual(footnotes[0].id, "1"); + }); +}); + +footnoteTypeIsIgnored('continuationSeparator'); +footnoteTypeIsIgnored('separator'); + +function footnoteTypeIsIgnored(type) { + describe('footnotes of type ' + type + ' are ignored', function() { + test('ID and body of footnote are read', function() { + var footnotes = readFootnotesXml({ + root: new XmlElement("w:footnotes", {}, [ + new XmlElement("w:footnote", {"w:id": "1", "w:type": type}, []) + ]) + }); + assert.equal(footnotes.length, 0); + }); + }); +} |
