Regression test for https://github.com/Textualize/textual/issues/2366
()
| 3 | |
| 4 | |
| 5 | async def test_switch_click_doesnt_bubble_up(): |
| 6 | """Regression test for https://github.com/Textualize/textual/issues/2366""" |
| 7 | |
| 8 | class SwitchApp(App[None]): |
| 9 | def compose(self) -> ComposeResult: |
| 10 | yield Switch() |
| 11 | |
| 12 | async def on_click(self) -> None: |
| 13 | raise AssertionError( |
| 14 | "The app should never receive a click event when Switch is clicked." |
| 15 | ) |
| 16 | |
| 17 | async with SwitchApp().run_test() as pilot: |
| 18 | await pilot.click(Switch) |