forked from Textualize/textual
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Textualize#2981 from seifertm/2366-switch-click-bu…
…bbling Fixes a bug that causes Click events to bubble up from Switch widgets.
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import Switch | ||
|
||
|
||
async def test_switch_click_doesnt_bubble_up(): | ||
"""Regression test for https://github.com/Textualize/textual/issues/2366""" | ||
|
||
class SwitchApp(App[None]): | ||
def compose(self) -> ComposeResult: | ||
yield Switch() | ||
|
||
async def on_click(self) -> None: | ||
raise AssertionError( | ||
"The app should never receive a click event when Switch is clicked." | ||
) | ||
|
||
async with SwitchApp().run_test() as pilot: | ||
await pilot.click(Switch) |