This commit is contained in:
Will McGugan
2022-09-02 10:04:58 +01:00
parent e555b8512f
commit d7eb1e21f4
3 changed files with 6 additions and 4 deletions

View File

@@ -112,10 +112,12 @@ def test_stylesheet_apply_user_css_over_widget_css():
node.add_class("a")
stylesheet = _make_user_stylesheet(user_css)
stylesheet.add_source(MyWidget.CSS, "widget.py:MyWidget", is_default_css=True)
stylesheet.add_source(
MyWidget.DEFAULT_CSS, "widget.py:MyWidget", is_default_css=True
)
stylesheet.apply(node)
# The node is red because user CSS overrides Widget.CSS
# The node is red because user CSS overrides Widget.DEFAULT_CSS
assert node.styles.color == Color(255, 0, 0)
# The background colour defined in the Widget still applies, since user CSS doesn't override it
assert node.styles.background == Color(0, 255, 0)