| 585 | skip_when=RUNNING_IN_WORKER and not upytest.is_micropython, |
| 586 | ) |
| 587 | async def test_when_decorator(self): |
| 588 | called = False |
| 589 | call_flag = asyncio.Event() |
| 590 | |
| 591 | buttons_collection = web.page.find("button") |
| 592 | |
| 593 | @when("click", buttons_collection) |
| 594 | def on_click(event): |
| 595 | nonlocal called |
| 596 | called = True |
| 597 | call_flag.set() |
| 598 | |
| 599 | # Now let's simulate a click on the button (using the low level JS API) |
| 600 | # so we don't risk dom getting in the way |
| 601 | assert not called |
| 602 | for button in buttons_collection: |
| 603 | button._dom_element.click() |
| 604 | await call_flag.wait() |
| 605 | assert called |
| 606 | called = False |
| 607 | call_flag.clear() |
| 608 | |
| 609 | def test_update_all_single_attribute(self): |
| 610 | """Test updating single attribute on all elements.""" |