diff options
| author | Jonathan Lehman <jonathan.lehman91@gmail.com> | 2017-02-18 11:48:22 -0500 |
|---|---|---|
| committer | Jonathan Lehman <jonathan.lehman91@gmail.com> | 2017-02-18 11:49:53 -0500 |
| commit | 35df4eed2249ee7e582cca4d371a78ce92c44d2a (patch) | |
| tree | d8aec937f9ae9e7a835c43cf6ffb777f2d40a898 | |
| parent | 2555036e27441428666e08408a082346fbef3b62 (diff) | |
Add test case for complex fields nested within a hyperlink complex field
| -rw-r--r-- | test/docx/body-reader.tests.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index 1882f3a..a670202 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -308,6 +308,55 @@ test("complex fields", (function() { }), isEmptyRun )); + }, + + "complex field nested within a hyperlink complex field is wrapped with the hyperlink": function() { + var authorInstrText = new XmlElement("w:instrText", {}, [ + xml.text(' AUTHOR "John Doe"') + ]); + var paragraphXml = new XmlElement("w:p", {}, [ + beginXml, + hyperlinkInstrText, + separateXml, + hyperlinkRunXml, + beginXml, + authorInstrText, + endXml, + endXml + ]); + var paragraph = readXmlElementValue(paragraphXml); + + assertThat(paragraph.children, contains( + isEmptyRun, + isRun({ + children: contains( + isHyperlink({ + href: uri, + children: [] + }) + ) + }), + isRun({ + children: contains( + isHyperlink({ + href: uri, + children: contains( + isText("this is a hyperlink") + ) + }) + ) + }), + isRun({ + children: contains( + isHyperlink({ + href: uri, + children: [] + }) + ) + }), + isEmptyRun, + isEmptyRun + )); } }; })()); |
