mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add a test for a radio set getting focus when a button gets clicked
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user