1
0
Fork 0

Adding upstream version 0.15.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 11:29:34 +01:00
parent 0184169650
commit c6da052ee9
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
47 changed files with 6799 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import pytest
from textual.app import App
from textual.widgets.text_area import Selection
from textual_textarea import TextEditor
@pytest.mark.parametrize(
"language,expected_marker",
[
("python", "# "),
("sql", "-- "),
# ("mysql", "# "),
# ("c", "// "),
],
)
@pytest.mark.asyncio
async def test_comments(app: App, language: str, expected_marker: str) -> None:
async with app.run_test() as pilot:
ta = app.query_one("#ta", expect_type=TextEditor)
ta.language = language
original_text = "foo bar baz"
ta.text = original_text
ta.selection = Selection((0, 0), (0, 0))
await pilot.press("ctrl+underscore") # alias for ctrl+/
assert ta.text == f"{expected_marker}{original_text}"
await pilot.press("ctrl+underscore") # alias for ctrl+/
assert ta.text == f"{original_text}"