Skip to content

Commit b3387a8

Browse files
committed
add test
1 parent 30802b8 commit b3387a8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_pilot.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,20 @@ class MyApp(App):
407407
with pytest.raises(StylesheetError):
408408
async with app.run_test() as pilot:
409409
await pilot.press("enter")
410+
411+
412+
async def test_click_by_widget():
413+
"""Test that click accept a Widget instance."""
414+
pressed = False
415+
416+
class TestApp(CenteredButtonApp):
417+
def on_button_pressed(self):
418+
nonlocal pressed
419+
pressed = True
420+
421+
app = TestApp()
422+
async with app.run_test() as pilot:
423+
button = app.query_one(Button)
424+
assert not pressed
425+
await pilot.click(button)
426+
assert pressed

0 commit comments

Comments
 (0)