mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* Add regression test for #2229. * Fix potential reactive-watch loop. * Simplify regression test. Labels are cheaper to use and the final visual result of the test won't depend on the directory it runs from. * Simplify solution. Turns out I didn't need a descriptor. :( * Fail on empty tab.
25 lines
712 B
Python
25 lines
712 B
Python
"""Regression test for https://github.com/Textualize/textual/issues/2229."""
|
|
from textual.app import App, ComposeResult
|
|
from textual.widgets import TabbedContent, TabPane, Tabs, Label
|
|
|
|
|
|
class QuicklyChangeTabsApp(App[None]):
|
|
def compose(self) -> ComposeResult:
|
|
with TabbedContent():
|
|
with TabPane("one"):
|
|
yield Label("one")
|
|
with TabPane("two"):
|
|
yield Label("two")
|
|
with TabPane("three", id="three"):
|
|
yield Label("three")
|
|
|
|
def key_p(self) -> None:
|
|
self.query_one(Tabs).action_next_tab()
|
|
self.query_one(Tabs).action_next_tab()
|
|
|
|
|
|
app = QuicklyChangeTabsApp()
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|