Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #4445 #4448

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/integration/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@

def FullyControlledInput():
"""App using a fully controlled input with implicit debounce wrapper."""
from typing import Optional

import reflex as rx

class State(rx.State):
text: str = "initial"
text: rx.Field[Optional[str]] = rx.field("initial")

def set_none(self):
self.text = None

app = rx.App(state=rx.State)

Expand Down Expand Up @@ -48,6 +53,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 +192,8 @@ async def get_state_text():
# assert backend_state.text == "" #noqa: ERA001
# assert debounce_input.get_attribute("value") == "" #noqa: ERA001
# assert value_input.get_attribute("value") == "" #noqa: ERA001

set_none_button = driver.find_element(By.ID, "set_none")
set_none_button.click()
assert AppHarness._poll_for(lambda: debounce_input.get_attribute("value") == "")
assert await get_state_text() is None
Loading