
* Add comments to html metadata component (#3731) * fix: add verification for path /404 (#3723) Co-authored-by: coolstorm <manas.gupta@fampay.in> * Use the new state name when setting `is_hydrated` to false (#3738) * Use `._is_mutable()` to account for parent state proxy (#3739) When a parent state proxy is set, also allow child StateProxy._self_mutable to override the parent's `_is_mutable()`. * bump to 0.5.9 (#3746) * add message when installing requirements.txt is needed for chosen template during init (#3750) * #3752 bugfix add domain for XAxis (#3764) * fix appharness app_source typing (#3777) * fix import clash between connectionToaster and hooks.useState (#3749) * use different registry when in china, fixes #3700 (#3702) * do not reload compilation if using local app in AppHarness (#3790) * do not reload if using local app * Update reflex/testing.py Co-authored-by: Masen Furer <m_github@0x26.net> --------- Co-authored-by: Masen Furer <m_github@0x26.net> * Bump memory on relevant actions (#3781) Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local> * [REF-3334] Validate Toast Props (#3793) * [REF-3536][REF-3537][REF-3541] Move chakra components into its repo(reflex-chakra) (#3798) * fix get_uuid_string_var (#3795) * minor State cleanup (#3768) * Fix code wrap in markdown (#3755) --------- Co-authored-by: Alek Petuskey <alek@pynecone.io> Co-authored-by: Manas Gupta <53006261+Manas1820@users.noreply.github.com> Co-authored-by: coolstorm <manas.gupta@fampay.in> Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com> Co-authored-by: Shubhankar Dimri <dimrishubhi@gmail.com> Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com> Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local> Co-authored-by: Elijah Ahianyo <elijahahianyo@gmail.com>
56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
import pytest
|
|
from reflex_chakra.components.media.icon import ICON_LIST, Icon
|
|
|
|
from reflex.utils import format
|
|
|
|
|
|
def test_no_tag_errors():
|
|
"""Test that an icon without a tag raises an error."""
|
|
with pytest.raises(AttributeError):
|
|
Icon.create()
|
|
|
|
|
|
def test_children_errors():
|
|
"""Test that an icon with children raises an error."""
|
|
with pytest.raises(AttributeError):
|
|
Icon.create("child", tag="search")
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"tag",
|
|
ICON_LIST,
|
|
)
|
|
def test_valid_icon(tag: str):
|
|
"""Test that a valid icon does not raise an error.
|
|
|
|
Args:
|
|
tag: The icon tag.
|
|
"""
|
|
icon = Icon.create(tag=tag)
|
|
assert icon.tag == format.to_title_case(tag) + "Icon"
|
|
|
|
|
|
@pytest.mark.parametrize("tag", ["", " ", "invalid", 123])
|
|
def test_invalid_icon(tag):
|
|
"""Test that an invalid icon raises an error.
|
|
|
|
Args:
|
|
tag: The icon tag.
|
|
"""
|
|
with pytest.raises(ValueError):
|
|
Icon.create(tag=tag)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"tag",
|
|
["Check", "Close", "eDit"],
|
|
)
|
|
def test_tag_with_capital(tag: str):
|
|
"""Test that an icon that tag with capital does not raise an error.
|
|
|
|
Args:
|
|
tag: The icon tag.
|
|
"""
|
|
icon = Icon.create(tag=tag)
|
|
assert icon.tag == format.to_title_case(tag) + "Icon"
|