From 033466fcb57ba2f4c0f876ed8dec705de5c68333 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 3 Aug 2025 07:47:58 +0100 Subject: Ignore style definitions using a style ID that has already been used --- test/docx/styles-reader.tests.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/docx/styles-reader.tests.js b/test/docx/styles-reader.tests.js index 0997d2c..b63bb6a 100644 --- a/test/docx/styles-reader.tests.js +++ b/test/docx/styles-reader.tests.js @@ -110,6 +110,16 @@ test('numbering style has numId read from paragraph properties', function() { assert.equal(styles.findNumberingStyleById("List1").numId, "42"); }); +test('when multiple style elements have same style ID then only first element is used', function() { + var styles = readStylesXml( + new XmlElement("w:styles", {}, [ + tableStyleElement("TableNormal", "Normal Table"), + tableStyleElement("TableNormal", "Table Normal") + ]) + ); + assert.equal(styles.findTableStyleById("TableNormal").name, "Normal Table"); +}); + function paragraphStyleElement(id, name) { return styleElement("paragraph", id, name); } -- cgit v1.2.3