Skip to content

Commit

Permalink
test for new method
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Mar 27, 2023
1 parent b26868a commit 635ca9d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 635ca9d

Please sign in to comment.