From 9d6e977e0e81345c3b1747b9385aaa5ace7df070 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 24 May 2023 09:15:43 +0100 Subject: [PATCH] Test messages when toggling a selection via user input --- tests/selection_list/test_selection_messages.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/selection_list/test_selection_messages.py b/tests/selection_list/test_selection_messages.py index 9736cb151..ea31c6ead 100644 --- a/tests/selection_list/test_selection_messages.py +++ b/tests/selection_list/test_selection_messages.py @@ -71,6 +71,19 @@ async def test_toggle() -> None: ] +async def test_toggle_via_user() -> None: + """Toggling via the user should result in the correct messages.""" + async with SelectionListApp().run_test() as pilot: + assert isinstance(pilot.app, SelectionListApp) + await pilot.press("space") + await pilot.pause() + assert pilot.app.messages == [ + ("SelectionHighlighted", 0), + ("SelectedChanged", None), + ("SelectionToggled", 0), + ] + + async def test_toggle_all() -> None: """Toggling all options should result in messages.""" async with SelectionListApp().run_test() as pilot: