mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
As an illustration for https://github.com/Textualize/textual/discussions/3037 and having written it it makes sense to drop it into the tests. As it is, it looks like Select has no tests so this is a handy kickstart.
17 lines
494 B
Python
17 lines
494 B
Python
"""Initially https://github.com/Textualize/textual/discussions/3037"""
|
|
|
|
from textual.app import App, ComposeResult
|
|
from textual.widgets import Select
|
|
|
|
|
|
class SelectApp(App[None]):
|
|
INITIAL_VALUE = 3
|
|
|
|
def compose(self) -> ComposeResult:
|
|
yield Select[int]([(str(n), n) for n in range(10)], value=self.INITIAL_VALUE)
|
|
|
|
|
|
async def test_select_initial_value():
|
|
async with SelectApp().run_test() as pilot:
|
|
assert pilot.app.query_one(Select).value == SelectApp.INITIAL_VALUE
|