mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add snapshot test for Center/Middle.
This commit is contained in:
File diff suppressed because one or more lines are too long
29
tests/snapshot_tests/snapshot_apps/alignment_containers.py
Normal file
29
tests/snapshot_tests/snapshot_apps/alignment_containers.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"""
|
||||||
|
App to test alignment containers.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.containers import Center, Middle
|
||||||
|
from textual.widgets import Button
|
||||||
|
|
||||||
|
|
||||||
|
class AlignContainersApp(App[None]):
|
||||||
|
CSS = """
|
||||||
|
Center {
|
||||||
|
tint: $primary 10%;
|
||||||
|
}
|
||||||
|
Middle {
|
||||||
|
tint: $secondary 10%;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
with Center():
|
||||||
|
yield Button.success("center")
|
||||||
|
with Middle():
|
||||||
|
yield Button.error("middle")
|
||||||
|
|
||||||
|
|
||||||
|
app = AlignContainersApp()
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run()
|
||||||
@@ -52,6 +52,10 @@ def test_layout_containers(snap_compare):
|
|||||||
assert snap_compare(SNAPSHOT_APPS_DIR / "layout_containers.py")
|
assert snap_compare(SNAPSHOT_APPS_DIR / "layout_containers.py")
|
||||||
|
|
||||||
|
|
||||||
|
def test_alignment_containers(snap_compare):
|
||||||
|
assert snap_compare(SNAPSHOT_APPS_DIR / "alignment_containers.py")
|
||||||
|
|
||||||
|
|
||||||
# --- Widgets - rendering and basic interactions ---
|
# --- Widgets - rendering and basic interactions ---
|
||||||
# Each widget should have a canonical example that is display in the docs.
|
# Each widget should have a canonical example that is display in the docs.
|
||||||
# When adding a new widget, ideally we should also create a snapshot test
|
# When adding a new widget, ideally we should also create a snapshot test
|
||||||
|
|||||||
Reference in New Issue
Block a user