mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add tests for placeholder widget.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -71,6 +71,11 @@ def test_buttons_render(snap_compare):
|
||||
assert snap_compare(WIDGET_EXAMPLES_DIR / "button.py", press=["tab"])
|
||||
|
||||
|
||||
def test_placeholder_render(snap_compare):
|
||||
# Testing the rendering of the multiple placeholder variants and labels.
|
||||
assert snap_compare(WIDGET_EXAMPLES_DIR / "placeholder.py")
|
||||
|
||||
|
||||
def test_datatable_render(snap_compare):
|
||||
press = ["tab", "down", "down", "right", "up", "left"]
|
||||
assert snap_compare(WIDGET_EXAMPLES_DIR / "data_table.py", press=press)
|
||||
|
||||
15
tests/test_placeholder.py
Normal file
15
tests/test_placeholder.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
|
||||
from textual.widgets import Placeholder
|
||||
from textual.widgets._placeholder import InvalidPlaceholderVariant
|
||||
|
||||
|
||||
def test_invalid_placeholder_variant():
|
||||
with pytest.raises(InvalidPlaceholderVariant):
|
||||
Placeholder("this is clearly not a valid variant!")
|
||||
|
||||
|
||||
def test_invalid_reactive_variant_change():
|
||||
p = Placeholder()
|
||||
with pytest.raises(InvalidPlaceholderVariant):
|
||||
p.variant = "this is clearly not a valid variant!"
|
||||
Reference in New Issue
Block a user