MCPcopy Index your code
hub / github.com/reactive-python/reactpy / test_html_to_vdom_transform

Function test_html_to_vdom_transform

src/py/reactpy/tests/test_utils.py:74–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72
73
74def test_html_to_vdom_transform():
75 source = "<p>hello <a>world</a> and <a>universe</a>lmao</p>"
76
77 def make_links_blue(node):
78 if node["tagName"] == "a":
79 node["attributes"] = {"style": {"color": "blue"}}
80 return node
81
82 expected = {
83 "tagName": "p",
84 "children": [
85 "hello ",
86 {
87 "tagName": "a",
88 "children": ["world"],
89 "attributes": {"style": {"color": "blue"}},
90 },
91 " and ",
92 {
93 "tagName": "a",
94 "children": ["universe"],
95 "attributes": {"style": {"color": "blue"}},
96 },
97 "lmao",
98 ],
99 }
100
101 assert html_to_vdom(source, make_links_blue) == expected
102
103
104def test_non_html_tag_behavior():

Callers

nothing calls this directly

Calls 1

html_to_vdomFunction · 0.90

Tested by

no test coverage detected