diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-05-18 20:12:25 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-05-18 20:12:25 +0100 |
| commit | d0b4eb76001049a23fe038025cfa56472703fa70 (patch) | |
| tree | ae48abeafbf170611e978d880447c5bb84d02e72 /tests/docx/body_xml_tests.py | |
| parent | 85f99611c84cf0853200fb358f135160c063b690 (diff) | |
Avoid parsing URI when replacing fragment
Diffstat (limited to 'tests/docx/body_xml_tests.py')
| -rw-r--r-- | tests/docx/body_xml_tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 1277238..cccf472 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -624,6 +624,18 @@ class HyperlinkTests(object): ) @istest + def existing_fragment_is_replaced_when_anchor_is_set_on_external_link(self): + relationships = Relationships({ + "r42": Relationship(target="http://example.com/#previous") + }) + run_element = xml_element("w:r") + element = xml_element("w:hyperlink", {"r:id": "r42", "w:anchor": "fragment"}, [run_element]) + assert_equal( + documents.hyperlink(href="http://example.com/#fragment", children=[documents.run([])]), + _read_and_get_document_xml_element(element, relationships=relationships) + ) + + @istest def hyperlink_is_read_as_internal_hyperlink_if_it_has_an_anchor_attribute(self): run_element = xml_element("w:r") element = xml_element("w:hyperlink", {"w:anchor": "start"}, [run_element]) |
