MCPcopy Index your code
hub / github.com/pyscript/pyscript / test_when_decorator

Method test_when_decorator

core/tests/python/tests/test_web.py:345–362  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

343 div.classes.remove("non-existent-class")
344
345 async def test_when_decorator(self):
346 called = False
347
348 just_a_button = web.page.find("#a-test-button")[0]
349 call_flag = asyncio.Event()
350
351 @when("click", just_a_button)
352 def on_click(event):
353 nonlocal called
354 called = True
355 call_flag.set()
356
357 # Now let's simulate a click on the button (using the low level JS API)
358 # so we don't risk dom getting in the way
359 assert not called
360 just_a_button._dom_element.click()
361 await call_flag.wait()
362 assert called
363
364 async def test_when_decorator_on_event(self):
365 called = False

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected