From 72dff52212817f05eff8b49b0fd1e2930ca0a404 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Fri, 7 Oct 2022 14:38:02 +0100 Subject: [PATCH] Unit test for Styles.css --- tests/css/test_styles.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/css/test_styles.py b/tests/css/test_styles.py index 84a5610db..a7c574ecc 100644 --- a/tests/css/test_styles.py +++ b/tests/css/test_styles.py @@ -123,6 +123,18 @@ def test_get_opacity_default(): assert styles.text_opacity == 1.0 +def test_styles_css_property(): + css = "opacity: 50%; text-opacity: 20%; background: green; color: red; tint: dodgerblue 20%;" + styles = Styles().parse(css, path="") + assert styles.css == ( + "background: #008000;\n" + "color: #FF0000;\n" + "opacity: 0.5;\n" + "text-opacity: 0.2;\n" + "tint: rgba(30,144,255,0.2);" + ) + + @pytest.mark.parametrize( "set_value, expected", [