diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_dock_none.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_dock_none.svg new file mode 100644 index 0000000000..6171bf35a8 --- /dev/null +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_dock_none.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + DockNone + + + + + + + + + + Hello                          +DockNone +^p palette + + + + + diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index 864f80e3fe..e5037f3818 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -8,7 +8,7 @@ from textual.containers import Vertical from textual.pilot import Pilot from textual.screen import Screen -from textual.widgets import Button, Input, RichLog, TextArea, Footer +from textual.widgets import Button, Header, Input, RichLog, TextArea, Footer from textual.widgets import Switch from textual.widgets import Label from textual.widgets.text_area import BUILTIN_LANGUAGES, Selection, TextAreaTheme @@ -738,6 +738,25 @@ def test_dock_scroll_off_by_one(snap_compare): ) +def test_dock_none(snap_compare): + """Checking that `dock:none` works in CSS and Python. + The label should appear at the top here, since we've undocked both + the header and footer. + """ + + class DockNone(App[None]): + CSS = "Header { dock: none; }" + + def compose(self) -> ComposeResult: + yield Label("Hello") + yield Header() + footer = Footer() + footer.styles.dock = "none" + yield footer + + assert snap_compare(DockNone(), terminal_size=(30, 5)) + + def test_scroll_to(snap_compare): # https://github.com/Textualize/textual/issues/2525 assert snap_compare(