diff options
author | Andrew Morgan <andrewm@element.io> | 2022-06-28 15:19:48 +0100 |
---|---|---|
committer | Andrew Morgan <andrewm@element.io> | 2022-06-28 15:19:48 +0100 |
commit | 6cba6a51af81cc3a6868752a8ec2189bc03d1cae (patch) | |
tree | 81858ec38cef11fb2e66460b4f646dc572b7bcfd /tests/rest/media | |
parent | Fix serialization errors when rotating notifications (#13118) (diff) | |
parent | Linkify GHSA commit (diff) | |
download | synapse-6cba6a51af81cc3a6868752a8ec2189bc03d1cae.tar.xz |
Merge branch 'master' into develop
Diffstat (limited to 'tests/rest/media')
-rw-r--r-- | tests/rest/media/v1/test_html_preview.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rest/media/v1/test_html_preview.py b/tests/rest/media/v1/test_html_preview.py index cbdf210aef..1062081a06 100644 --- a/tests/rest/media/v1/test_html_preview.py +++ b/tests/rest/media/v1/test_html_preview.py @@ -411,6 +411,23 @@ class OpenGraphFromHtmlTestCase(unittest.TestCase): }, ) + def test_nested_nodes(self) -> None: + """A body with some nested nodes. Tests that we iterate over children + in the right order (and don't reverse the order of the text).""" + html = b""" + <a href="somewhere">Welcome <b>the bold <u>and underlined text <svg> + with a cheeky SVG</svg></u> and <strong>some</strong> tail text</b></a> + """ + tree = decode_body(html, "http://example.com/test.html") + og = parse_html_to_open_graph(tree) + self.assertEqual( + og, + { + "og:title": None, + "og:description": "Welcome\n\nthe bold\n\nand underlined text\n\nand\n\nsome\n\ntail text", + }, + ) + class MediaEncodingTestCase(unittest.TestCase): def test_meta_charset(self) -> None: |