
* 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
22 lines
717 B
Python
22 lines
717 B
Python
from reflex.components.radix.primitives.form import Form
|
|
from reflex.event import EventChain
|
|
from reflex.vars.base import Var
|
|
|
|
|
|
def test_render_on_submit():
|
|
"""Test that on_submit event chain is rendered as a separate function."""
|
|
submit_it = Var(
|
|
_js_expr="submit_it",
|
|
_var_type=EventChain,
|
|
)
|
|
f = Form.create(on_submit=submit_it)
|
|
exp_submit_name = f"handleSubmit_{f.handle_submit_unique_name}" # type: ignore
|
|
assert f"onSubmit={{{exp_submit_name}}}" in f.render()["props"]
|
|
|
|
|
|
def test_render_no_on_submit():
|
|
"""A form without on_submit should not render a submit handler."""
|
|
f = Form.create()
|
|
for prop in f.render()["props"]:
|
|
assert "onSubmit" not in prop
|