Skip to content

Commit 985fcb1

Browse files
committed
fix tests and snapshots
1 parent 5d9ffca commit 985fcb1

8 files changed

+459
-470
lines changed

tests/command_palette/test_interaction.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def on_mount(self) -> None:
1919

2020

2121
async def test_initial_list_no_highlight() -> None:
22-
"""When the list initially appears, nothing will be highlighted."""
22+
"""When the list initially appears, the first item is highlghted."""
2323
async with CommandPaletteApp().run_test() as pilot:
2424
assert CommandPalette.is_open(pilot.app)
2525
assert pilot.app.screen.query_one(CommandList).visible is False
2626
await pilot.press("a")
2727
assert pilot.app.screen.query_one(CommandList).visible is True
28-
assert pilot.app.screen.query_one(CommandList).highlighted is None
28+
assert pilot.app.screen.query_one(CommandList).highlighted == 0
2929

3030

3131
async def test_down_arrow_selects_an_item() -> None:
@@ -35,32 +35,19 @@ async def test_down_arrow_selects_an_item() -> None:
3535
assert pilot.app.screen.query_one(CommandList).visible is False
3636
await pilot.press("a")
3737
assert pilot.app.screen.query_one(CommandList).visible is True
38-
assert pilot.app.screen.query_one(CommandList).highlighted is None
38+
assert pilot.app.screen.query_one(CommandList).highlighted == 0
3939
await pilot.press("down")
40-
assert pilot.app.screen.query_one(CommandList).highlighted is not None
40+
assert pilot.app.screen.query_one(CommandList).highlighted == 1
4141

4242

4343
async def test_enter_selects_an_item() -> None:
44-
"""Typing in a search value then pressing enter should select a command."""
44+
"""Typing in a search value then pressing enter should dismiss the command palette."""
4545
async with CommandPaletteApp().run_test() as pilot:
4646
assert CommandPalette.is_open(pilot.app)
4747
assert pilot.app.screen.query_one(CommandList).visible is False
4848
await pilot.press("a")
4949
assert pilot.app.screen.query_one(CommandList).visible is True
50-
assert pilot.app.screen.query_one(CommandList).highlighted is None
51-
await pilot.press("enter")
52-
assert pilot.app.screen.query_one(CommandList).highlighted is not None
53-
54-
55-
async def test_selection_of_command_closes_command_palette() -> None:
56-
"""Selecting a command from the list should close the list."""
57-
async with CommandPaletteApp().run_test() as pilot:
58-
assert CommandPalette.is_open(pilot.app)
59-
assert pilot.app.screen.query_one(CommandList).visible is False
60-
await pilot.press("a")
61-
assert pilot.app.screen.query_one(CommandList).visible is True
62-
assert pilot.app.screen.query_one(CommandList).highlighted is None
63-
await pilot.press("enter")
64-
assert pilot.app.screen.query_one(CommandList).highlighted is not None
50+
assert pilot.app.screen.query_one(CommandList).highlighted == 0
6551
await pilot.press("enter")
6652
assert not CommandPalette.is_open(pilot.app)
53+
assert not pilot.app.screen.query(CommandList)

tests/snapshot_tests/__snapshots__/test_snapshots/test_ansi_command_palette.svg

Lines changed: 68 additions & 67 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_app_search_commands_opens_and_displays_search_list.svg

Lines changed: 62 additions & 62 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_command_palette.svg

Lines changed: 62 additions & 62 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_command_palette_discovery.svg

Lines changed: 62 additions & 62 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_example_color_command.svg

Lines changed: 56 additions & 56 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_markup_command_list.svg

Lines changed: 65 additions & 65 deletions
Loading

tests/snapshot_tests/__snapshots__/test_snapshots/test_system_commands.svg

Lines changed: 77 additions & 76 deletions
Loading

0 commit comments

Comments
 (0)