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

Function test_simple_layout

src/py/reactpy/tests/test_core/test_layout.py:79–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78
79async def test_simple_layout():
80 set_state_hook = reactpy.Ref()
81
82 @reactpy.component
83 def SimpleComponent():
84 tag, set_state_hook.current = reactpy.hooks.use_state("div")
85 return reactpy.vdom(tag)
86
87 async with reactpy.Layout(SimpleComponent()) as layout:
88 update_1 = await layout.render()
89 assert update_1 == update_message(
90 path="",
91 model={"tagName": "", "children": [{"tagName": "div"}]},
92 )
93
94 set_state_hook.current("table")
95
96 update_2 = await layout.render()
97 assert update_2 == update_message(
98 path="",
99 model={"tagName": "", "children": [{"tagName": "table"}]},
100 )
101
102
103async def test_nested_component_layout():

Callers

nothing calls this directly

Calls 4

update_messageFunction · 0.90
SimpleComponentFunction · 0.85
renderMethod · 0.45
currentMethod · 0.45

Tested by

no test coverage detected