
* delete most references to varr * [REF-3562][REF-3563] Replace chakra usage (#3872) * only one mention of var * delete vars.py why not * remove reflex.vars * rename immutable var to var * rename ivars to vars * add vars back smh * ruff * no more create_safe * reorder deprecated * remove raises * remove all Var.create * move to new api * fix unit tests * fix pyi hopefully * sort literals * fix event handler issues * update poetry * fix silly issues i'm very silly * add var_operation_return * rename immutable to not immutable * add str type * it's ruff out there --------- Co-authored-by: Elijah Ahianyo <elijahahianyo@gmail.com>
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
|