mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
@@ -1,7 +1,14 @@
|
||||
"""Test basic functioning of some containers."""
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Center, Horizontal, HorizontalScroll, Middle
|
||||
from textual.containers import (
|
||||
Center,
|
||||
Horizontal,
|
||||
HorizontalScroll,
|
||||
Middle,
|
||||
Vertical,
|
||||
VerticalScroll,
|
||||
)
|
||||
from textual.widgets import Label
|
||||
|
||||
|
||||
@@ -34,6 +41,35 @@ async def test_horizontal_vs_horizontalscroll_scrolling():
|
||||
assert horizontal_scroll.scrollbars_enabled == (False, True)
|
||||
|
||||
|
||||
async def test_vertical_vs_verticalscroll_scrolling():
|
||||
"""Check the default scrollbar behaviours for `Vertical` and `VerticalScroll`."""
|
||||
|
||||
class VerticalsApp(App[None]):
|
||||
CSS = """
|
||||
Screen {
|
||||
layout: horizontal;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
with Vertical():
|
||||
for _ in range(10):
|
||||
yield Label("How is life going?\n" * 3 + "\n\n")
|
||||
with VerticalScroll():
|
||||
for _ in range(10):
|
||||
yield Label("How is life going?\n" * 3 + "\n\n")
|
||||
|
||||
WIDTH = 80
|
||||
HEIGHT = 24
|
||||
app = VerticalsApp()
|
||||
async with app.run_test(size=(WIDTH, HEIGHT)):
|
||||
vertical = app.query_one(Vertical)
|
||||
vertical_scroll = app.query_one(VerticalScroll)
|
||||
assert vertical.size.width == vertical_scroll.size.width
|
||||
assert vertical.scrollbars_enabled == (False, False)
|
||||
assert vertical_scroll.scrollbars_enabled == (True, False)
|
||||
|
||||
|
||||
async def test_center_container():
|
||||
"""Check the size of the container `Center`."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user