diff --git a/tests/toggles/test_radioset.py b/tests/toggles/test_radioset.py index b2869eb5a..95025bf37 100644 --- a/tests/toggles/test_radioset.py +++ b/tests/toggles/test_radioset.py @@ -11,7 +11,7 @@ class RadioSetApp(App[None]): def compose(self) -> ComposeResult: with RadioSet(id="from_buttons"): - yield RadioButton() + yield RadioButton(id="clickme") yield RadioButton() yield RadioButton(value=True) yield RadioSet("One", "True", "Three", id="from_strings") @@ -36,6 +36,14 @@ async def test_radio_sets_initial_state(): assert pilot.app.events_received == [] +async def test_click_sets_focus(): + """Clicking within a radio set should set focus.""" + async with RadioSetApp().run_test() as pilot: + assert pilot.app.screen.focused is None + await pilot.click("#clickme") + assert pilot.app.screen.focused == pilot.app.query_one("#from_buttons") + + async def test_radio_sets_toggle(): """Test the status of the radio sets after they've been toggled.""" async with RadioSetApp().run_test() as pilot: