diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4c6448a1..49c41a921e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.87.1] - 2024-11-24 + +## Fixed + +- Fixed offset not being applied to grid layout https://github.com/Textualize/textual/pull/5281 ## [0.87.0] - 2024-11-24 diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_grid_offset.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_grid_offset.svg new file mode 100644 index 0000000000..2ca648c75f --- /dev/null +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_grid_offset.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GridOffsetApp + + + + + + + + + + ┌────────────────────────┐┌─────────────────────────┐┌─────────────────────────┐ +One││Two││Three +││││ +││││ +││││ +││││ +││││ +││││ +││││ +││││ +││││ +└────────────────────────┘└─────────────────────────┘└─────────────────────────┘ +┌────────────────────────┐┌─────────────────────────┐ +Four││Five +││ +││ +││ +││ +││ +││ +││ +││ +││┌─────────────────────────┐ +└────────────────────────┘└─────────────────────────┘Six + + + diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py index cf4f6e849c..265a2e2c6e 100644 --- a/tests/snapshot_tests/test_snapshots.py +++ b/tests/snapshot_tests/test_snapshots.py @@ -2681,3 +2681,37 @@ def compose(self) -> ComposeResult: yield Label("Relative 3", classes="relative offset3") assert snap_compare(AbsoluteApp()) + + +def test_grid_offset(snap_compare): + """Regression test for https://github.com/Textualize/textual/issues/5279 + You should see 6 boxes arranged in a 3x2 grid. The 6th should be offset 10 lines down. + """ + + class GridOffsetApp(App): + CSS = """ + Screen { + layout: grid; + grid-size: 3 2; + } + + .box { + height: 100%; + border: solid green; + } + + #six { + offset: 0 10; + background: blue; + } + """ + + def compose(self) -> ComposeResult: + yield Static("One", classes="box") + yield Static("Two", classes="box") + yield Static("Three", classes="box") + yield Static("Four", classes="box") + yield Static("Five", classes="box") + yield Static("Six", classes="box", id="six") + + assert snap_compare(GridOffsetApp())