Fix #5: keep browse control visible

This commit is contained in:
Philip Henning 2026-09-08 17:13:27 +02:00
parent 40aa66d164
commit 1b19d5eca2
2 changed files with 14 additions and 7 deletions

View file

@ -52,6 +52,7 @@ class _FormatModal(ModalScreen):
#path-input { margin-top: 1; } #path-input { margin-top: 1; }
#workflow-error { color: $error; height: auto; margin-top: 1; } #workflow-error { color: $error; height: auto; margin-top: 1; }
#workflow-warning { color: $warning; height: auto; margin-top: 1; } #workflow-warning { color: $warning; height: auto; margin-top: 1; }
.browse-button { width: 16; margin-top: 1; }
.button-row { margin-top: 1; height: 3; align: center middle; } .button-row { margin-top: 1; height: 3; align: center middle; }
""" """
@ -90,9 +91,8 @@ class ExportModal(_FormatModal):
classes="format-copy", classes="format-copy",
) )
yield Label("Export file path") yield Label("Export file path")
with Horizontal():
yield Input(placeholder="/path/to/entries.hosts", id="path-input") yield Input(placeholder="/path/to/entries.hosts", id="path-input")
yield Button("Browse…", id="browse-button") yield Button("Browse…", id="browse-button", classes="browse-button")
with RadioSet(id="format-select"): with RadioSet(id="format-select"):
for index, format in enumerate(self._formats): for index, format in enumerate(self._formats):
yield RadioButton( yield RadioButton(
@ -175,9 +175,8 @@ class ImportModal(_FormatModal):
classes="format-copy", classes="format-copy",
) )
yield Label("Import file path") yield Label("Import file path")
with Horizontal():
yield Input(placeholder="/path/to/entries.hosts", id="path-input") yield Input(placeholder="/path/to/entries.hosts", id="path-input")
yield Button("Browse…", id="browse-button") yield Button("Browse…", id="browse-button", classes="browse-button")
with RadioSet(id="format-select"): with RadioSet(id="format-select"):
for index, format in enumerate(self._formats): for index, format in enumerate(self._formats):
yield RadioButton( yield RadioButton(

View file

@ -3,7 +3,7 @@
from unittest.mock import Mock from unittest.mock import Mock
import pytest import pytest
from textual.widgets import Input, RadioButton, Static from textual.widgets import Button, Input, RadioButton, Static
from hosts.core.import_export import ( from hosts.core.import_export import (
ExportFormat, ExportFormat,
@ -67,6 +67,14 @@ async def test_export_browser_lets_the_user_choose_a_destination_directory():
async with app.run_test(size=(120, 40)) as pilot: async with app.run_test(size=(120, 40)) as pilot:
await pilot.press("ctrl+x") await pilot.press("ctrl+x")
await pilot.pause() await pilot.pause()
browse = app.screen.query_one("#browse-button", Button)
path_input = app.screen.query_one("#path-input", Input)
container = app.screen.query_one("#format-container")
assert browse.region.width > 0
assert browse.region.x >= path_input.region.x
assert browse.region.y >= path_input.region.bottom
assert browse.region.right <= container.region.right
assert browse.region.bottom <= container.region.bottom
await pilot.press("tab") await pilot.press("tab")
await pilot.press("enter") await pilot.press("enter")
await pilot.pause() await pilot.pause()