Add more testing of clicking on links

This commit is contained in:
Dave Pearson
2023-09-07 16:39:47 +01:00
parent 1c1836e7f4
commit 3b0e86bfef
2 changed files with 7 additions and 4 deletions

View File

@@ -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

View File

@@ -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))