diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-11-30 11:36:24 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-11-30 11:36:24 +0000 |
| commit | 500e1c20fe77c7ebd561e9f7d8c2b494ebdfced2 (patch) | |
| tree | 2260a797c680605217093d5a5247c778a7269924 /test/docx | |
| parent | 0a86099a0d60c8bfe404cf66b5e5f1fb1549bb1d (diff) | |
Parse checked value of complex field checkbox
Diffstat (limited to 'test/docx')
| -rw-r--r-- | test/docx/body-reader.tests.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index 49c81b9..70b0057 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -588,6 +588,48 @@ test("checkboxes", { ) }) )); + }, + + "complex field checkbox with w:default=1 and w:checked=0 is unchecked": function() { + var paragraphXml = complexFieldCheckboxParagraph([ + xml.element("w:checkBox", {}, [ + xml.element("w:default", {"w:val": "1"}), + xml.element("w:checked", {"w:val": "0"}) + ]) + ]); + + var paragraph = readXmlElementValue(paragraphXml); + + assertThat(paragraph.children, contains( + isEmptyRun, + isEmptyRun, + isRun({ + children: contains( + isCheckbox({checked: equalTo(false)}) + ) + }) + )); + }, + + "complex field checkbox with w:default=0 and w:checked=1 is checked": function() { + var paragraphXml = complexFieldCheckboxParagraph([ + xml.element("w:checkBox", {}, [ + xml.element("w:default", {"w:val": "0"}), + xml.element("w:checked", {"w:val": "1"}) + ]) + ]); + + var paragraph = readXmlElementValue(paragraphXml); + + assertThat(paragraph.children, contains( + isEmptyRun, + isEmptyRun, + isRun({ + children: contains( + isCheckbox({checked: equalTo(true)}) + ) + }) + )); } }); |
