Skip to content
Discussion options

You must be logged in to vote

Something like this?

from textual.app import App, ComposeResult
from textual.widgets import Select
from textual.widgets._select import SelectOverlay


class SelectApp(App[None]):
    def compose(self) -> ComposeResult:
        yield Select[int]([(str(n), n) for n in range(10)])


async def test_select() -> None:
    async with SelectApp().run_test() as pilot:
        select_widget = pilot.app.query_one(Select)
        assert select_widget.expanded is False

        await pilot.click(Select)
        assert select_widget.expanded is True

        await pilot.click(SelectOverlay, offset=(2, 4))
        assert select_widget.value == 2
        assert select_widget.expanded is False

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@geekkid1
Comment options

@geekkid1
Comment options

@TomJGooding
Comment options

Answer selected by geekkid1
@geekkid1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants