Skip to content

Commit 3170197

Browse files
committed
snapshot
1 parent a95c37b commit 3170197

File tree

3 files changed

+189
-1
lines changed

3 files changed

+189
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Fixed infinite loop in `Widget.anchor` https://github.com/Textualize/textual/pull/5290
1313
- Restores the ability to supply console markup to command list https://github.com/Textualize/textual/pull/5294
1414
- Fixed delayed App Resize event https://github.com/Textualize/textual/pull/5296
15+
- Fixed issue with auto-generated tab IDs https://github.com/Textualize/textual/pull/5298
1516

1617
## [0.87.1] - 2024-11-24
1718

Lines changed: 156 additions & 0 deletions
Loading

tests/snapshot_tests/test_snapshots.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
Tab,
3636
Tabs,
3737
TextArea,
38+
TabbedContent,
39+
TabPane,
3840
)
3941
from textual.widgets.text_area import BUILTIN_LANGUAGES, Selection, TextAreaTheme
4042
from textual.theme import Theme
@@ -2752,7 +2754,6 @@ async def run_before(pilot: Pilot) -> None:
27522754
snap_compare(TallSelectApp(), run_before=run_before)
27532755

27542756

2755-
27562757
def test_markup_command_list(snap_compare):
27572758
"""Regression test for https://github.com/Textualize/textual/issues/5276
27582759
You should see a command list, with console markup applied to the action name and help text."""
@@ -2769,6 +2770,7 @@ def on_mount(self) -> None:
27692770

27702771
snap_compare(MyApp())
27712772

2773+
27722774
def test_app_resize_order(snap_compare):
27732775
"""Regression test for https://github.com/Textualize/textual/issues/5284
27742776
You should see a placeholder with text "BAR", focused and scrolled down so it fills the screen.
@@ -2810,3 +2812,32 @@ def on_resize(self) -> None:
28102812

28112813
snap_compare(SCApp())
28122814

2815+
2816+
def test_add_remove_tabs(snap_compare):
2817+
"""Regression test for https://github.com/Textualize/textual/issues/5215
2818+
You should see a TabbedContent with two panes, entitled 'tab-2' and 'tab-3'"""
2819+
2820+
class ExampleApp(App):
2821+
BINDINGS = [
2822+
("r", "remove_pane", "Remove first pane"),
2823+
("a", "add_pane", "Add pane"),
2824+
]
2825+
2826+
def compose(self) -> ComposeResult:
2827+
with TabbedContent(initial="tab-2"):
2828+
with TabPane("tab-1"):
2829+
yield Label("tab-1")
2830+
with TabPane("tab-2"):
2831+
yield Label("tab-2")
2832+
yield Footer()
2833+
2834+
def action_remove_pane(self) -> None:
2835+
tabbed_content = self.query_one(TabbedContent)
2836+
tabbed_content.remove_pane("tab-1")
2837+
2838+
def action_add_pane(self) -> None:
2839+
tabbed_content = self.query_one(TabbedContent)
2840+
new_pane = TabPane("tab-3", Label("tab-3"))
2841+
tabbed_content.add_pane(new_pane)
2842+
2843+
snap_compare(ExampleApp(), press=["a", "r"])

0 commit comments

Comments
 (0)