MCPcopy
hub / github.com/Textualize/textual / test_select_into_scrollable_container

Function test_select_into_scrollable_container

tests/test_selection.py:74–98  ·  view source on GitHub ↗

Selecting from outside (above) into a scrollable container should pick up items scrolled above the visible area.

()

Source from the content-addressed store, hash-verified

72
73
74async def test_select_into_scrollable_container():
75 """Selecting from outside (above) into a scrollable container should pick up
76 items scrolled above the visible area."""
77
78 app = _ScrollableSelectApp()
79 async with app.run_test(size=(20, 10)) as pilot:
80 await pilot.pause()
81 scroller = app.query_one("#scroller", VerticalScroll)
82 # Scroll so items 00-02 are scrolled above the visible area.
83 scroller.scroll_to(y=3, animate=False)
84 await pilot.pause()
85
86 # Selection: start on "BEFORE" (y=0), end inside the container on the
87 # last visible row.
88 assert await pilot.mouse_down(offset=(0, 0))
89 await pilot.pause()
90 assert await pilot.mouse_up(offset=(7, 5))
91 selected_text = app.screen.get_selected_text() or ""
92
93 assert "BEFORE" in selected_text
94 for i in range(0, 7):
95 assert (
96 f"item-{i:02d}" in selected_text
97 ), f"item-{i:02d} missing from {selected_text!r}"
98 assert "AFTER" not in selected_text
99
100
101async def test_select_out_of_scrollable_container():

Callers

nothing calls this directly

Calls 8

run_testMethod · 0.80
query_oneMethod · 0.80
mouse_downMethod · 0.80
mouse_upMethod · 0.80
get_selected_textMethod · 0.80
pauseMethod · 0.45
scroll_toMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…