This commit is contained in:
Will McGugan
2024-11-27 14:20:41 +00:00
parent 4c6b3e6d8f
commit 340731d4fc
2 changed files with 195 additions and 0 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -2749,3 +2749,45 @@ def test_select_width_auto(snap_compare):
await pilot.click("Select")
snap_compare(TallSelectApp(), run_before=run_before)
def test_app_resize_order(snap_compare):
"""Regression test for https://github.com/Textualize/textual/issues/5284
You should see a placeholder with text "BAR", focused and scrolled down so it fills the screen.
"""
class FocusPlaceholder(Placeholder, can_focus=True):
pass
class NarrowScreen(Screen):
AUTO_FOCUS = "#bar"
def compose(self) -> ComposeResult:
yield FocusPlaceholder("FOO", id="foo")
yield FocusPlaceholder("BAR", id="bar")
class SCApp(App):
CSS = """
Placeholder:focus {
border: heavy white;
}
#foo {
height: 24;
}
#bar {
height: 1fr;
}
.narrow #bar {
height: 100%;
}
"""
def on_mount(self) -> None:
self.push_screen(NarrowScreen())
def on_resize(self) -> None:
self.add_class("narrow")
snap_compare(SCApp())