diff options
| author | Michael Williamson <mike@zwobble.org> | 2019-03-17 10:24:44 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2019-03-17 10:24:44 +0000 |
| commit | 59d569588c22a429b6da8a696119b7b35a6603a9 (patch) | |
| tree | 70f29c19ec1ba318c282759ffe9f596652938f24 /test | |
| parent | fcd3d606cfcd58e715705aaae0627a425e5484a5 (diff) | |
Read numbering styles
Diffstat (limited to 'test')
| -rw-r--r-- | test/docx/styles-reader.tests.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/docx/styles-reader.tests.js b/test/docx/styles-reader.tests.js index 43cba98..0997d2c 100644 --- a/test/docx/styles-reader.tests.js +++ b/test/docx/styles-reader.tests.js @@ -79,6 +79,37 @@ test('style name is null if w:name element does not exist', function() { assert.equal(styles.findCharacterStyleById("Heading1Char").name, null); }); +test('numbering style is null if no style with that ID exists', function() { + var styles = readStylesXml( + new XmlElement("w:styles", {}, []) + ); + assert.equal(styles.findNumberingStyleById("List1"), null); +}); + +test('numbering style has null numId if style has no paragraph properties', function() { + var styles = readStylesXml( + new XmlElement("w:styles", {}, [ + new XmlElement("w:style", {"w:type": "numbering", "w:styleId": "List1"}) + ]) + ); + assert.equal(styles.findNumberingStyleById("List1").numId, null); +}); + +test('numbering style has numId read from paragraph properties', function() { + var styles = readStylesXml( + new XmlElement("w:styles", {}, [ + new XmlElement("w:style", {"w:type": "numbering", "w:styleId": "List1"}, [ + new XmlElement("w:pPr", {}, [ + new XmlElement("w:numPr", {}, [ + new XmlElement("w:numId", {"w:val": "42"}) + ]) + ]) + ]) + ]) + ); + assert.equal(styles.findNumberingStyleById("List1").numId, "42"); +}); + function paragraphStyleElement(id, name) { return styleElement("paragraph", id, name); } |
