From 0cd2f2ef233572e4b2795ecbfa7a4edd29fd8945 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 12 Apr 2020 15:04:28 +0100 Subject: Only parse integer font sizes --- test/docx/body-reader.tests.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index 73c8647..1260575 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -580,6 +580,14 @@ test("run has fontSize read from properties", function() { assert.deepEqual(run.fontSize, 14); }); +test("run with invalid w:sz has null font size", function() { + var fontSizeXml = new XmlElement("w:sz", {"w:val": "28a"}); + var runXml = runWithProperties([fontSizeXml]); + + var run = readXmlElementValue(runXml); + assert.deepEqual(run.fontSize, null); +}); + test("run properties not included as child of run", function() { var runStyleXml = new XmlElement("w:rStyle"); var runPropertiesXml = new XmlElement("w:rPr", {}, [runStyleXml]); -- cgit v1.2.3