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

Function test_select_across_scrollable_container

tests/test_selection.py:126–148  ·  view source on GitHub ↗

Selecting from outside (above) to outside (below) of a scrollable container should select all of its content.

()

Source from the content-addressed store, hash-verified

124
125
126async def test_select_across_scrollable_container():
127 """Selecting from outside (above) to outside (below) of a scrollable
128 container should select all of its content."""
129
130 app = _ScrollableSelectApp()
131 async with app.run_test(size=(20, 10)) as pilot:
132 await pilot.pause()
133 scroller = app.query_one("#scroller", VerticalScroll)
134 scroller.scroll_to(y=2, animate=False)
135 await pilot.pause()
136
137 # Selection: BEFORE (y=0) to AFTER (y=7).
138 assert await pilot.mouse_down(offset=(0, 0))
139 await pilot.pause()
140 assert await pilot.mouse_up(offset=(0, 7))
141 selected_text = app.screen.get_selected_text() or ""
142
143 assert "BEFORE" in selected_text
144 assert "AFTER" in selected_text
145 for i in range(0, 10):
146 assert (
147 f"item-{i:02d}" in selected_text
148 ), f"item-{i:02d} missing from {selected_text!r}"
149
150
151class _GappedScrollApp(App):

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…