From 2113f415a0318a9737d560aa373f55cb7e7ad426 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 4 May 2023 15:17:52 +0100 Subject: [PATCH] Add a test that toggling a pressed radio button has no effect --- tests/toggles/test_radioset.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/toggles/test_radioset.py b/tests/toggles/test_radioset.py index dc9de5b1b..20980b8d9 100644 --- a/tests/toggles/test_radioset.py +++ b/tests/toggles/test_radioset.py @@ -52,6 +52,15 @@ async def test_radio_sets_toggle(): ] +async def test_radioset_same_button_mash(): + """Mashing the same button should have no effect.""" + async with RadioSetApp().run_test() as pilot: + assert pilot.app.query_one("#from_buttons", RadioSet).pressed_index == 2 + pilot.app.query_one("#from_buttons", RadioSet)._nodes[2].toggle() + assert pilot.app.query_one("#from_buttons", RadioSet).pressed_index == 2 + assert pilot.app.events_received == [] + + async def test_radioset_inner_navigation(): """Using the cursor keys should navigate between buttons in a set.""" async with RadioSetApp().run_test() as pilot: