accidentally pushed unfinished changes
This commit is contained in:
parent
9ec9ab7929
commit
03eda2e90e
@ -44,7 +44,7 @@ def BackgroundTask():
|
||||
|
||||
@rx.event(background=True)
|
||||
async def fast_yielding(self):
|
||||
for _ in range(100):
|
||||
for _ in range(1000):
|
||||
yield State.increment()
|
||||
|
||||
@rx.event
|
||||
@ -174,6 +174,11 @@ def BackgroundTask():
|
||||
on_click=State.yield_in_async_with_self,
|
||||
id="yield-in-async-with-self",
|
||||
),
|
||||
rx.button(
|
||||
"Fast Yielding",
|
||||
on_click=State.fast_yielding,
|
||||
id="fast-yielding",
|
||||
),
|
||||
rx.button("Reset", on_click=State.reset_counter, id="reset"),
|
||||
)
|
||||
|
||||
@ -397,11 +402,11 @@ def test_fast_yielding(
|
||||
assert background_task.app_instance is not None
|
||||
|
||||
# get a reference to all buttons
|
||||
fast_yielding_button = driver.find_element(By.ID, "yield-increment")
|
||||
fast_yielding_button = driver.find_element(By.ID, "fast-yielding")
|
||||
|
||||
# get a reference to the counter
|
||||
counter = driver.find_element(By.ID, "counter")
|
||||
assert background_task._poll_for(lambda: counter.text == "0", timeout=5)
|
||||
|
||||
fast_yielding_button.click()
|
||||
assert background_task._poll_for(lambda: counter.text == "100", timeout=5)
|
||||
assert background_task._poll_for(lambda: counter.text == "1000", timeout=50)
|
||||
|
Loading…
Reference in New Issue
Block a user