reflex/tests/units/components/radix/test_icon_button.py
Thomas Brandého 3f538865b5
reorganize all tests in a single top folder (#3981)
* lift node version restraint to allow more recent version if already installed

* add node test for latest version

* change python version

* use purple for debug logs

* update workflow

* add playwright dev dependency

* update workflow

* change test

* oops

* improve test

* update test

* fix tests

* mv units tests to a subfolder

* reorganize tests

* fix install

* update test_state

* revert node changes and only keep new tests organization

* move integration tests in tests/integration

* fix integration workflow

* fix dockerfile workflow

* fix dockerfile workflow 2

* fix shared_state
2024-09-26 01:22:52 +02:00

31 lines
838 B
Python

import pytest
from reflex.components.lucide.icon import Icon
from reflex.components.radix.themes.components.icon_button import IconButton
from reflex.style import Style
from reflex.vars.base import LiteralVar
def test_icon_button():
ib1 = IconButton.create("activity")
assert isinstance(ib1, IconButton)
ib2 = IconButton.create(Icon.create("activity"))
assert isinstance(ib2, IconButton)
assert isinstance(ib1.add_style(), Style)
assert isinstance(ib2.add_style(), Style)
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=LiteralVar.create("2"))
assert isinstance(ib2, IconButton)