-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ec7d0c
commit 33e318d
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.screen import Screen | ||
from textual.widgets import Label | ||
|
||
|
||
async def test_links(): | ||
"""Regression test for https://github.com/Textualize/textual/issues/4536""" | ||
messages: list[str] = [] | ||
|
||
class HomeScreen(Screen[None]): | ||
def compose(self) -> ComposeResult: | ||
yield Label("[@click=app.bell_message('hi')]Ring the bell![/]") | ||
|
||
class ScreenNamespace(App[None]): | ||
def get_default_screen(self) -> HomeScreen: | ||
return HomeScreen() | ||
|
||
def action_bell_message(self, message: str) -> None: | ||
nonlocal messages | ||
messages.append(message) | ||
|
||
async with ScreenNamespace().run_test() as pilot: | ||
await pilot.click(offset=(5, 0)) | ||
assert messages == ["hi"] |