mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* simplify loading * ws removal * no need for this * simplify * gutter * tests and refactor * ws * ws * restore * move to compositor * words * tweak timeout in snapshot
34 lines
825 B
Python
34 lines
825 B
Python
from textual.app import App, ComposeResult
|
|
from textual.containers import VerticalScroll
|
|
from textual.widgets import Label
|
|
|
|
|
|
class LoadingApp(App[None]):
|
|
CSS = """
|
|
VerticalScroll {
|
|
height: 20;
|
|
}
|
|
"""
|
|
|
|
BINDINGS = [("l", "loading")]
|
|
|
|
def compose(self) -> ComposeResult:
|
|
with VerticalScroll():
|
|
yield Label("another big label\n" * 30) # Ensure there's a scrollbar.
|
|
|
|
def action_loading(self):
|
|
self.query_one(VerticalScroll).loading = True
|
|
|
|
|
|
async def test_loading_disables_and_remove_scrollbars():
|
|
app = LoadingApp()
|
|
async with app.run_test() as pilot:
|
|
vs = app.query_one(VerticalScroll)
|
|
# Sanity checks:
|
|
assert not vs._check_disabled()
|
|
|
|
await pilot.press("l")
|
|
await pilot.pause()
|
|
|
|
assert vs._check_disabled()
|