Verify a lambda returning rx.cond with a FunctionVar branch and an EventSpec branch. Each branch is exercised end-to-end: the FunctionVar branch updates a DOM data-attribute via a frontend-only function, and the EventSpec branch dispatches a backend event handler. Args: eve
(event_chain: AppHarness, driver: WebDriver)
| 748 | |
| 749 | |
| 750 | def test_mixed_cond_event_lambda(event_chain: AppHarness, driver: WebDriver): |
| 751 | """Verify a lambda returning rx.cond with a FunctionVar branch and an EventSpec branch. |
| 752 | |
| 753 | Each branch is exercised end-to-end: the FunctionVar branch updates a DOM |
| 754 | data-attribute via a frontend-only function, and the EventSpec branch |
| 755 | dispatches a backend event handler. |
| 756 | |
| 757 | Args: |
| 758 | event_chain: AppHarness for the event_chain app |
| 759 | driver: selenium WebDriver open to the app |
| 760 | """ |
| 761 | assert_token(event_chain, driver) |
| 762 | cond_input = driver.find_element(By.ID, "cond_input") |
| 763 | marker = driver.find_element(By.ID, "mixed_cond_marker") |
| 764 | btn = driver.find_element(By.ID, "mixed_cond_btn") |
| 765 | |
| 766 | # Default cond_input ("") -> EventSpec branch fires the backend handler. |
| 767 | btn.click() |
| 768 | poll_assert_event_order(driver, ["event_arg:ev_branch"]) |
| 769 | assert marker.get_attribute("data-value") == "" |
| 770 | |
| 771 | # Switch to the FunctionVar branch and click again. |
| 772 | cond_input.send_keys("fn") |
| 773 | assert event_chain.poll_for_content(marker, exp_not_equal="") == "fn" |
| 774 | btn.click() |
| 775 | AppHarness._poll_for(lambda: marker.get_attribute("data-value") == "fn_branch") |
| 776 | assert marker.get_attribute("data-value") == "fn_branch" |
| 777 | # Backend event order is unchanged because only the frontend function ran. |
| 778 | poll_assert_event_order(driver, ["event_arg:ev_branch"]) |
nothing calls this directly
no test coverage detected