Add a snapshot test for a rebuilt Select

This helps test the practical impact of the fix added for #2557.
This commit is contained in:
Dave Pearson
2023-05-16 14:34:18 +01:00
parent 32fa259c94
commit 3d2e3d9092
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
"""Test https://github.com/Textualize/textual/issues/2557"""
from textual.app import App, ComposeResult
from textual.widgets import Select, Button
class SelectRebuildApp(App[None]):
def compose(self) -> ComposeResult:
yield Select[int]((("1", 1), ("2", 2)))
yield Button("Rebuild")
def on_button_pressed(self):
self.query_one(Select).set_options((
("This", 0), ("Should", 1), ("Be", 2),
("What", 3), ("Goes", 4), ("Into",5),
("The", 6), ("Snapshit", 7)
))
if __name__ == "__main__":
SelectRebuildApp().run()