aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-04-22 15:50:00 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-22 15:50:00 +0100
commita515d2ebe7ab8ed5e92164b7b75c4d573cb2716e (patch)
tree5035595cb0f987d5fc093a086ac5230ccf3e71a8 /tests
parentc7d276d53bb2459e1393efd7635c32d6330ddf0c (diff)
Handle complex fields that do not have a "separate" fldChar.
Diffstat (limited to 'tests')
-rw-r--r--tests/docx/body_xml_tests.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py
index 5964acd..d112349 100644
--- a/tests/docx/body_xml_tests.py
+++ b/tests/docx/body_xml_tests.py
@@ -412,6 +412,30 @@ class ComplexFieldTests(object):
self._is_empty_hyperlinked_run,
is_empty_run,
)))
+
+ @istest
+ def field_without_separate_fld_char_is_ignored(self):
+ element = xml_element("w:p", {}, [
+ self._BEGIN_COMPLEX_FIELD,
+ self._HYPERLINK_INSTRTEXT,
+ self._SEPARATE_COMPLEX_FIELD,
+ self._BEGIN_COMPLEX_FIELD,
+ self._END_COMPLEX_FIELD,
+ _run_element_with_text("this is a hyperlink"),
+ self._END_COMPLEX_FIELD,
+ ])
+ paragraph = _read_and_get_document_xml_element(element)
+
+ assert_that(paragraph, is_paragraph(children=is_sequence(
+ is_empty_run,
+ self._is_empty_hyperlinked_run,
+ self._is_empty_hyperlinked_run,
+ self._is_empty_hyperlinked_run,
+ self._is_hyperlinked_run(children=is_sequence(
+ is_text("this is a hyperlink"),
+ )),
+ is_empty_run,
+ )))
@istest