mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add more testing of clicking on links
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
* [First](test_markdownviewer.md#first)
|
||||
* [Second](test_markdownviewer.md#second)
|
||||
* [Third](test_markdownviewer.md#third)
|
||||
* [Second](#second)
|
||||
* [Third](./test_markdownviewer.md#third)
|
||||
|
||||
# First
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.geometry import Offset
|
||||
from textual.widgets import Markdown, MarkdownViewer
|
||||
@@ -14,10 +16,11 @@ class MarkdownViewerApp(App[None]):
|
||||
await self.query_one(MarkdownViewer).go(Path(__file__).with_suffix(".md"))
|
||||
|
||||
|
||||
async def test_markdown_viewer_anchor_link() -> None:
|
||||
@pytest.mark.parametrize("link", [0, 1, 2])
|
||||
async def test_markdown_viewer_anchor_link(link: int) -> None:
|
||||
"""Test https://github.com/Textualize/textual/issues/3094"""
|
||||
async with MarkdownViewerApp().run_test() as pilot:
|
||||
# There's not really anything to test *for* here, but the lack of an
|
||||
# exception is the win (before the fix this is testing it would have
|
||||
# been FileNotFoundError).
|
||||
await pilot.click(Markdown, Offset(2, 1))
|
||||
await pilot.click(Markdown, Offset(2, link))
|
||||
|
||||
Reference in New Issue
Block a user