mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* feat: add rule widget * add star to init Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com> * remove unnecessary validations * update rule styles * add tests for invalid rules * add minimum heights and widths * tidy up examples * remove old example * move examples styling to tcss * modify examples to fit docs screenshots * add docs first draft * add snapshot tests * add rule to widget gallery * make non-widget rule classes available * tentatively update changelog --------- Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com> Co-authored-by: Will McGugan <willmcgugan@gmail.com>
27 lines
718 B
Python
27 lines
718 B
Python
import pytest
|
|
|
|
from textual.widgets import Rule
|
|
from textual.widgets.rule import InvalidLineStyle, InvalidRuleOrientation
|
|
|
|
|
|
def test_invalid_rule_orientation():
|
|
with pytest.raises(InvalidRuleOrientation):
|
|
Rule(orientation="invalid orientation!")
|
|
|
|
|
|
def test_invalid_rule_line_style():
|
|
with pytest.raises(InvalidLineStyle):
|
|
Rule(line_style="invalid line style!")
|
|
|
|
|
|
def test_invalid_reactive_rule_orientation_change():
|
|
rule = Rule()
|
|
with pytest.raises(InvalidRuleOrientation):
|
|
rule.orientation = "invalid orientation!"
|
|
|
|
|
|
def test_invalid_reactive_rule_line_style_change():
|
|
rule = Rule()
|
|
with pytest.raises(InvalidLineStyle):
|
|
rule.line_style = "invalid line style!"
|