Update tests to handle scroll changes to Container

See #2361.
This commit is contained in:
Dave Pearson
2023-04-24 11:10:37 +01:00
parent a91b2c6b35
commit b896e9d7f9
8 changed files with 23 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
from rich.align import VerticalCenter
from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.containers import Horizontal, VerticalScroll
from textual.widgets import Button, ContentSwitcher, DataTable, Markdown
MARKDOWN_EXAMPLE = """# Three Flavours Cornetto
@@ -37,7 +39,8 @@ class ContentSwitcherApp(App[None]):
with ContentSwitcher(initial="data-table"): # (4)!
yield DataTable(id="data-table")
yield Markdown(MARKDOWN_EXAMPLE, id="markdown")
with VerticalScroll(id="markdown"):
yield Markdown(MARKDOWN_EXAMPLE)
def on_button_pressed(self, event: Button.Pressed) -> None:
self.query_one(ContentSwitcher).current = event.button.id # (5)!