reflex/tests/components/radix/test_icon_button.py
Thomas Brandého bf0ebb8d09
Lendemor/improve coverage (#2988)
* add more tests

* add tests to raise coverage

* more tests, bump coverage to 73

* fix up icon_button test

* fix darglint for app.py

* fix utcnow usage warning

* set threshold to 72

* fix timestamp

* fix unit tests for linux-redis

* removed commented code and put a TODO
2024-04-04 14:31:43 +02:00

29 lines
786 B
Python

import pytest
from reflex.components.lucide.icon import Icon
from reflex.components.radix.themes.base import Theme
from reflex.components.radix.themes.components.icon_button import IconButton
from reflex.vars import Var
def test_icon_button():
ib1 = IconButton.create("activity")
ib1._apply_theme(Theme.create())
assert isinstance(ib1, IconButton)
ib2 = IconButton.create(Icon.create("activity"))
assert isinstance(ib2, IconButton)
def test_icon_button_no_child():
with pytest.raises(ValueError):
_ = IconButton.create()
def test_icon_button_size_prop():
ib1 = IconButton.create("activity", size="2")
assert isinstance(ib1, IconButton)
ib2 = IconButton.create("activity", size=Var.create("2"))
assert isinstance(ib2, IconButton)