
* 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
30 lines
764 B
Python
30 lines
764 B
Python
import pytest
|
|
|
|
from reflex.components.base.bare import Bare
|
|
from reflex.vars.base import Var
|
|
|
|
STATE_VAR = Var(_js_expr="default_state.name")
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"contents,expected",
|
|
[
|
|
("hello", '{"hello"}'),
|
|
("{}", '{"{}"}'),
|
|
(None, '{""}'),
|
|
(STATE_VAR, "{default_state.name}"),
|
|
# This behavior is now unsupported.
|
|
# ("${default_state.name}", "${default_state.name}"),
|
|
# ("{state.name}", "{state.name}"),
|
|
],
|
|
)
|
|
def test_fstrings(contents, expected):
|
|
"""Test that fstrings are rendered correctly.
|
|
|
|
Args:
|
|
contents: The contents of the component.
|
|
expected: The expected output.
|
|
"""
|
|
comp = Bare.create(contents).render()
|
|
assert comp["contents"] == expected
|