From e568765535b48643e1377dfd8479920fa755feb0 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 17 Mar 2019 20:53:23 +0000 Subject: Follow w:numStyleLink in w:abstractNum --- test/docx/numbering-xml.tests.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/docx/numbering-xml.tests.js b/test/docx/numbering-xml.tests.js index a9f825a..dd400a7 100644 --- a/test/docx/numbering-xml.tests.js +++ b/test/docx/numbering-xml.tests.js @@ -32,6 +32,32 @@ test('w:num element inherits levels from w:abstractNum', function() { })); }); + +test('when w:abstractNum has w:numStyleLink then style is used to find w:num', function() { + var numbering = readNumberingXml( + new XmlElement("w:numbering", {}, [ + new XmlElement("w:abstractNum", {"w:abstractNumId": "100"}, [ + new XmlElement("w:lvl", {"w:ilvl": "0"}, [ + new XmlElement("w:numFmt", {"w:val": "decimal"}) + ]) + ]), + new XmlElement("w:abstractNum", {"w:abstractNumId": "101"}, [ + new XmlElement("w:numStyleLink", {"w:val": "List1"}) + ]), + new XmlElement("w:num", {"w:numId": "200"}, [ + new XmlElement("w:abstractNumId", {"w:val": "100"}) + ]), + new XmlElement("w:num", {"w:numId": "201"}, [ + new XmlElement("w:abstractNumId", {"w:val": "101"}) + ]) + ]), + {styles: new stylesReader.Styles({}, {}, {}, {"List1": {numId: "200"}})} + ); + duck.assertThat(numbering.findLevel("201", "0"), duck.hasProperties({ + isOrdered: true + })); +}); + test('when styles is missing then error is thrown', function() { assert.throws(function() { readNumberingXml(new XmlElement("w:numbering", {}, [])); -- cgit v1.2.3