Skip to content

Commit

Permalink
test #4445
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-bartscher committed Nov 27, 2024
1 parent 697e26c commit aebbd19
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/integration/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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"),
)


Expand Down Expand Up @@ -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") == "")

0 comments on commit aebbd19

Please sign in to comment.