Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed May 22, 2024
1 parent 3ec7d0c commit 33e318d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_links.py
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"]

0 comments on commit 33e318d

Please sign in to comment.