Add container 'Middle'.

Related issues: #1957.
This commit is contained in:
Rodrigo Girão Serrão
2023-03-09 15:24:13 +00:00
parent f91750ed3d
commit e111449856
3 changed files with 29 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
"""Test basic functioning of some containers."""
from textual.app import App, ComposeResult
from textual.containers import Center, Horizontal, HorizontalScroll
from textual.containers import Center, Horizontal, HorizontalScroll, Middle
from textual.widgets import Label
@@ -47,3 +47,18 @@ async def test_center_container():
center = app.query_one(Center)
assert center.size.width == app.size.width
assert center.size.height == 3
async def test_middle_container():
"""Check the size of the container `Middle`."""
class MiddleApp(App[None]):
def compose(self) -> ComposeResult:
with Middle():
yield Label("1234")
app = MiddleApp()
async with app.run_test():
middle = app.query_one(Middle)
assert middle.size.width == 4
assert middle.size.height == app.size.height