diff --git a/src/hosts/tui/import_export_modal.py b/src/hosts/tui/import_export_modal.py index 2649dd4..a4c03c7 100644 --- a/src/hosts/tui/import_export_modal.py +++ b/src/hosts/tui/import_export_modal.py @@ -52,6 +52,7 @@ class _FormatModal(ModalScreen): #path-input { margin-top: 1; } #workflow-error { color: $error; 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; } """ @@ -90,9 +91,8 @@ class ExportModal(_FormatModal): classes="format-copy", ) yield Label("Export file path") - with Horizontal(): - yield Input(placeholder="/path/to/entries.hosts", id="path-input") - yield Button("Browse…", id="browse-button") + yield Input(placeholder="/path/to/entries.hosts", id="path-input") + yield Button("Browse…", id="browse-button", classes="browse-button") with RadioSet(id="format-select"): for index, format in enumerate(self._formats): yield RadioButton( @@ -175,9 +175,8 @@ class ImportModal(_FormatModal): classes="format-copy", ) yield Label("Import file path") - with Horizontal(): - yield Input(placeholder="/path/to/entries.hosts", id="path-input") - yield Button("Browse…", id="browse-button") + yield Input(placeholder="/path/to/entries.hosts", id="path-input") + yield Button("Browse…", id="browse-button", classes="browse-button") with RadioSet(id="format-select"): for index, format in enumerate(self._formats): yield RadioButton( diff --git a/tests/test_import_export_workflow.py b/tests/test_import_export_workflow.py index c93f666..664b9cf 100644 --- a/tests/test_import_export_workflow.py +++ b/tests/test_import_export_workflow.py @@ -3,7 +3,7 @@ from unittest.mock import Mock import pytest -from textual.widgets import Input, RadioButton, Static +from textual.widgets import Button, Input, RadioButton, Static from hosts.core.import_export import ( 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: await pilot.press("ctrl+x") 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("enter") await pilot.pause()