From 53e02510f14a4ed91d1ef5f194be564a83e05fb4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 22 Apr 2017 15:46:01 +0100 Subject: Handle complex fields that do not have a "separate" fldChar --- test/docx/body-reader.tests.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index 1b9a392..ffcc7d8 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -309,6 +309,33 @@ test("complex fields", (function() { isEmptyHyperlinkedRun, isEmptyRun )); + }, + + "field without separate element is ignored": function() { + var hyperlinkRunXml = runOfText("this is a hyperlink"); + var paragraphXml = new XmlElement("w:p", {}, [ + beginXml, + hyperlinkInstrText, + separateXml, + beginXml, + endXml, + hyperlinkRunXml, + endXml + ]); + var paragraph = readXmlElementValue(paragraphXml); + + assertThat(paragraph.children, contains( + isEmptyRun, + isEmptyHyperlinkedRun, + isEmptyHyperlinkedRun, + isEmptyHyperlinkedRun, + isHyperlinkedRun({ + children: contains( + isText("this is a hyperlink") + ) + }), + isEmptyRun + )); } }; })()); -- cgit v1.2.3