mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Invisible widgets now dont render
This commit is contained in:
28
tests/test_widget.py
Normal file
28
tests/test_widget.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user