diff options
| author | Michael Williamson <mike@zwobble.org> | 2021-01-09 13:12:32 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2021-01-09 13:12:32 +0000 |
| commit | 83431a6feb6c4bb402b5c4f7c5f6e9b6d7123426 (patch) | |
| tree | bbb693a8371ead102be0ac48c7d136724fa717b0 /test/docx/numbering-xml.tests.js | |
| parent | 9e7ca2e4a9020a488a1d7b9f371cf09f7aa69c02 (diff) | |
Support numbering defined by paragraph style
Diffstat (limited to 'test/docx/numbering-xml.tests.js')
| -rw-r--r-- | test/docx/numbering-xml.tests.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/docx/numbering-xml.tests.js b/test/docx/numbering-xml.tests.js index dd400a7..1eefd37 100644 --- a/test/docx/numbering-xml.tests.js +++ b/test/docx/numbering-xml.tests.js @@ -58,6 +58,31 @@ test('when w:abstractNum has w:numStyleLink then style is used to find w:num', f })); }); + +// See: 17.9.23 pStyle (Paragraph Style's Associated Numbering Level) in ECMA-376, 4th Edition +test('numbering level can be found by paragraph style ID', function() { + var numbering = readNumberingXml( + new XmlElement("w:numbering", {}, [ + new XmlElement("w:abstractNum", {"w:abstractNumId": "42"}, [ + new XmlElement("w:lvl", {"w:ilvl": "0"}, [ + new XmlElement("w:numFmt", {"w:val": "bullet"}) + ]) + ]), + new XmlElement("w:abstractNum", {"w:abstractNumId": "43"}, [ + new XmlElement("w:lvl", {"w:ilvl": "0"}, [ + new XmlElement("w:pStyle", {"w:val": "List"}), + new XmlElement("w:numFmt", {"w:val": "decimal"}) + ]) + ]) + ]), + {styles: stylesReader.defaultStyles} + ); + duck.assertThat(numbering.findLevelByParagraphStyleId("List"), duck.hasProperties({ + isOrdered: true + })); + duck.assertThat(numbering.findLevelByParagraphStyleId("Paragraph"), duck.equalTo(null)); +}); + test('when styles is missing then error is thrown', function() { assert.throws(function() { readNumberingXml(new XmlElement("w:numbering", {}, [])); |
