Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 5, 2024
1 parent 30802b8 commit b3387a8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,20 @@ class MyApp(App):
with pytest.raises(StylesheetError):
async with app.run_test() as pilot:
await pilot.press("enter")


async def test_click_by_widget():
"""Test that click accept a Widget instance."""
pressed = False

class TestApp(CenteredButtonApp):
def on_button_pressed(self):
nonlocal pressed
pressed = True

app = TestApp()
async with app.run_test() as pilot:
button = app.query_one(Button)
assert not pressed
await pilot.click(button)
assert pressed

0 comments on commit b3387a8

Please sign in to comment.