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

Function test_use_linked_inputs

src/py/reactpy/tests/test_widgets.py:33–53  ·  view source on GitHub ↗
(display: DisplayFixture)

Source from the content-addressed store, hash-verified

31
32
33async def test_use_linked_inputs(display: DisplayFixture):
34 @reactpy.component
35 def SomeComponent():
36 i_1, i_2 = reactpy.widgets.use_linked_inputs([{"id": "i_1"}, {"id": "i_2"}])
37 return reactpy.html.div(i_1, i_2)
38
39 await display.show(SomeComponent)
40
41 input_1 = await display.page.wait_for_selector("#i_1")
42 input_2 = await display.page.wait_for_selector("#i_2")
43
44 await input_1.type("hello", delay=DEFAULT_TYPE_DELAY)
45
46 assert (await input_1.evaluate("e => e.value")) == "hello"
47 assert (await input_2.evaluate("e => e.value")) == "hello"
48
49 await input_2.focus()
50 await input_2.type(" world", delay=DEFAULT_TYPE_DELAY)
51
52 assert (await input_1.evaluate("e => e.value")) == "hello world"
53 assert (await input_2.evaluate("e => e.value")) == "hello world"
54
55
56async def test_use_linked_inputs_on_change(display: DisplayFixture):

Callers

nothing calls this directly

Calls 1

showMethod · 0.80

Tested by

no test coverage detected