| 31 | |
| 32 | |
| 33 | async 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 | |
| 56 | async def test_use_linked_inputs_on_change(display: DisplayFixture): |