diff --git a/tests/integration/test_input.py b/tests/integration/test_input.py index c718749aaa8..948aea40c33 100644 --- a/tests/integration/test_input.py +++ b/tests/integration/test_input.py @@ -12,9 +12,13 @@ def FullyControlledInput(): """App using a fully controlled input with implicit debounce wrapper.""" import reflex as rx + from typing import Optional class State(rx.State): - text: str = "initial" + text: Optional[str] = "initial" + + def set_none(self): + self.text = None app = rx.App(state=rx.State) @@ -48,6 +52,7 @@ def index(): rx.button( "CLEAR", on_click=rx.set_value("on_change_input", ""), id="clear" ), + rx.button("SET NONE", on_click=State.set_none, id="set_none"), ) @@ -186,3 +191,8 @@ async def get_state_text(): # assert backend_state.text == "" # assert debounce_input.get_attribute("value") == "" # assert value_input.get_attribute("value") == "" + + set_none_button = driver.find_element(By.ID, "set_none") + set_none_button.click() + assert await get_state_text() == None + assert AppHarness._poll_for(lambda: debounce_input.get_attribute("value") == "")