fix broken unit tests in test_app

This commit is contained in:
Elijah 2024-06-13 10:59:24 +00:00
parent 3947b8430d
commit 56a30ea7ff
2 changed files with 6 additions and 6 deletions

View File

@ -2082,10 +2082,6 @@ class TriggerState(rx.State):
"""Sample event handler."""
pass
def do_another_thing(self, value):
"""Sample event handler with arg."""
pass
@pytest.mark.parametrize(
"component, output",
@ -2141,7 +2137,7 @@ class TriggerState(rx.State):
rx.box(
rx.text(
"random text",
on_click=lambda val: TriggerState.do_another_thing(val), # type: ignore
on_blur=lambda: TriggerState.do_something,
),
),
True,

View File

@ -1392,8 +1392,12 @@ def test_app_state_determination():
a4 = App()
assert a4.state is None
# Referencing an event handler enables state.
a4.add_page(rx.box(rx.button("Click", on_click=rx.console_log(""))), route="/")
assert a4.state is None
a4.add_page(
rx.box(rx.button("Click", on_click=DynamicState.on_counter)), route="/page2"
)
assert a4.state is not None