@@ -63,7 +63,27 @@ def it_provides_access_to_the_runs_it_contains(
6363
6464 actual = [type (item ).__name__ for item in runs ]
6565 expected = ["Run" for _ in range (count )]
66- assert actual == expected , f"expected: { expected } , got: { actual } "
66+ assert actual == expected
67+
68+ @pytest .mark .parametrize (
69+ ("hlink_cxml" , "expected_text" ),
70+ [
71+ ("w:hyperlink" , "" ),
72+ ("w:hyperlink/w:r" , "" ),
73+ ('w:hyperlink/w:r/w:t"foobar"' , "foobar" ),
74+ ('w:hyperlink/w:r/(w:t"foo",w:lastRenderedPageBreak,w:t"bar")' , "foobar" ),
75+ ('w:hyperlink/w:r/(w:t"abc",w:tab,w:t"def",w:noBreakHyphen)' , "abc\t def-" ),
76+ ],
77+ )
78+ def it_knows_the_visible_text_of_the_link (
79+ self , hlink_cxml : str , expected_text : str , fake_parent : t .StoryChild
80+ ):
81+ hlink = cast (CT_Hyperlink , element (hlink_cxml ))
82+ hyperlink = Hyperlink (hlink , fake_parent )
83+
84+ text = hyperlink .text
85+
86+ assert text == expected_text
6787
6888 # -- fixtures --------------------------------------------------------------------
6989
0 commit comments