mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'main' into fix-2063
This commit is contained in:
File diff suppressed because one or more lines are too long
48
tests/snapshot_tests/snapshot_apps/layer_fix.py
Normal file
48
tests/snapshot_tests/snapshot_apps/layer_fix.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Vertical
|
||||
from textual.widgets import Header, Footer, Label
|
||||
from textual.binding import Binding
|
||||
|
||||
|
||||
class Dialog(Vertical):
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Compose the child widgets."""
|
||||
yield Label("This should not cause a scrollbar to appear")
|
||||
|
||||
|
||||
class DialogIssueApp(App[None]):
|
||||
CSS = """
|
||||
Screen {
|
||||
layers: base dialog;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
Dialog {
|
||||
align: center middle;
|
||||
border: round red;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
layer: dialog;
|
||||
offset: 50% 50%;
|
||||
}
|
||||
"""
|
||||
|
||||
BINDINGS = [
|
||||
Binding("d", "dialog", "Toggle the dialog"),
|
||||
]
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
yield Vertical()
|
||||
yield Dialog(classes="hidden")
|
||||
yield Footer()
|
||||
|
||||
def action_dialog(self) -> None:
|
||||
self.query_one(Dialog).toggle_class("hidden")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
DialogIssueApp().run()
|
||||
@@ -354,3 +354,8 @@ def test_css_hot_reloading(snap_compare):
|
||||
assert snap_compare(
|
||||
SNAPSHOT_APPS_DIR / "hot_reloading_app.py", run_before=run_before
|
||||
)
|
||||
|
||||
|
||||
def test_layer_fix(snap_compare):
|
||||
# Check https://github.com/Textualize/textual/issues/1358
|
||||
assert snap_compare(SNAPSHOT_APPS_DIR / "layer_fix.py", press=["d"])
|
||||
|
||||
Reference in New Issue
Block a user