From 635ca9d075807348847a977e2174fe2681495c81 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 27 Mar 2023 11:38:32 +0100 Subject: [PATCH] test for new method --- tests/test_style.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_style.py b/tests/test_style.py index bf02af83..b5c01729 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -229,3 +229,25 @@ def test_from_meta(): def test_on(): style = Style.on({"foo": "bar"}, click="CLICK") + Style(color="red") assert style.meta == {"foo": "bar", "@click": "CLICK"} + + +def test_clear_meta_and_links(): + style = Style.parse("bold red on black link https://example.org") + Style.on( + click="CLICK" + ) + + assert style.meta == {"@click": "CLICK"} + assert style.link == "https://example.org" + assert style.color == Color.parse("red") + assert style.bgcolor == Color.parse("black") + assert style.bold + assert not style.italic + + clear_style = style.clear_meta_and_links() + + assert clear_style.meta == {} + assert clear_style.link == None + assert clear_style.color == Color.parse("red") + assert clear_style.bgcolor == Color.parse("black") + assert clear_style.bold + assert not clear_style.italic