mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
29 lines
701 B
Python
29 lines
701 B
Python
import pytest
|
|
|
|
from textual.css.errors import StyleValueError
|
|
from textual.widget import Widget
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"set_val, get_val, style_str", [
|
|
[True, True, "visible"],
|
|
[False, False, "hidden"],
|
|
["hidden", False, "hidden"],
|
|
["visible", True, "visible"],
|
|
])
|
|
def test_widget_set_visible_true(set_val, get_val, style_str):
|
|
widget = Widget()
|
|
widget.visible = set_val
|
|
|
|
assert widget.visible is get_val
|
|
assert widget.styles.visibility == style_str
|
|
|
|
|
|
def test_widget_set_visible_invalid_string():
|
|
widget = Widget()
|
|
|
|
with pytest.raises(StyleValueError):
|
|
widget.visible = "nope! no widget for me!"
|
|
|
|
assert widget.visible
|