Enhance filter modal: prevent stacking and improve tab navigation
This commit is contained in:
parent
9f8e9c3415
commit
167a6596b2
4 changed files with 318 additions and 245 deletions
|
|
@ -72,6 +72,51 @@ async def test_filter_shortcut_opens_modal_and_applies_the_selected_filter():
|
|||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_filter_shortcut_does_not_stack_filter_modals():
|
||||
"""Repeated filter shortcuts keep the existing filter modal in focus."""
|
||||
app = app_with_filterable_entries()
|
||||
|
||||
async with app.run_test() as pilot:
|
||||
await pilot.press("ctrl+f")
|
||||
await pilot.pause()
|
||||
|
||||
await pilot.press("ctrl+f")
|
||||
await pilot.press("ctrl+f")
|
||||
await pilot.pause()
|
||||
|
||||
assert isinstance(app.screen, FilterModal)
|
||||
assert sum(isinstance(screen, FilterModal) for screen in app.screen_stack) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_filter_modal_tabs_through_controls_in_visual_order():
|
||||
"""The modal starts at Presets and tabs through the visible controls in order."""
|
||||
app = app_with_filterable_entries()
|
||||
|
||||
async with app.run_test() as pilot:
|
||||
await pilot.press("ctrl+f")
|
||||
await pilot.pause()
|
||||
|
||||
assert app.focused is app.screen.query_one("#preset-select")
|
||||
for expected_id in (
|
||||
"load-preset",
|
||||
"save-preset",
|
||||
"delete-preset",
|
||||
"status-filter-type",
|
||||
"type-filter-type",
|
||||
"resolution-filter-type",
|
||||
"search-term",
|
||||
"search-hostnames",
|
||||
"search-comments",
|
||||
"search-ips",
|
||||
"search-case-sensitive",
|
||||
"apply",
|
||||
):
|
||||
await pilot.press("tab")
|
||||
assert app.focused is app.screen.query_one(f"#{expected_id}")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_filter_reset_clears_filters_and_cancel_preserves_applied_filters():
|
||||
"""Reset clears the form on Apply, while Cancel leaves the applied filter alone."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue