scroll visible snapshot (#2225)

* scroll visible snapshot

* change text of test
This commit is contained in:
Will McGugan
2023-04-06 11:13:09 +01:00
committed by GitHub
parent eadd487584
commit 5c514b0dab
2 changed files with 80 additions and 57 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Label, Static
# Checks https://github.com/Textualize/textual/issues/2181
class MyCustomWidget(Static):
def compose(self) -> ComposeResult:
yield Label(("|\n" * 100)[:-1])
yield Label("SHOULD BE VISIBLE", id="target")
class MyApp(App):
def compose(self) -> ComposeResult:
with VerticalScroll():
yield MyCustomWidget()
def key_t(self) -> None:
self.query_one("#target").scroll_visible()
if __name__ == "__main__":
MyApp().run()