reflex/tests/components/core/test_html.py
Thomas Brandého 0af4770180
generate pyi files when building/publishing 3rd party component (#2945)
* build pyi files when building/publishing 3rd party

* fix typo in workflow

* add future annotation

* add tests to pass coverage check

* add more unit tests

* omit pyi_generator from test coverage

* change black from dev deps to direct deps

* remake all pyi

* format pyi if black is present, return as if otherwise

* fix requested changes

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-03-29 09:54:21 -07:00

20 lines
510 B
Python

import pytest
from reflex.components.core.html import Html
def test_html_no_children():
with pytest.raises(ValueError):
_ = Html.create()
def test_html_many_children():
with pytest.raises(ValueError):
_ = Html.create("foo", "bar")
def test_html_create():
html = Html.create("<p>Hello !</p>")
assert str(html.dangerouslySetInnerHTML) == '{"__html": "<p>Hello !</p>"}' # type: ignore
assert str(html) == '<div dangerouslySetInnerHTML={{"__html": "<p>Hello !</p>"}}/>'