reflex/tests
Masen Furer c636c91c9c
[REF-2273] Implement .setvar special EventHandler (#3163)
* Allow EventHandler args to be partially applied

When an EventHandler is called with an incomplete set of args it creates a
partial EventSpec. This change allows Component._create_event_chain to apply
remaining args from an args_spec to an existing EventSpec to make it
functional.

Instead of requiring the use of `lambda` functions to pass arguments to an
EventHandler, they can now be passed directly and any remaining args defined in
the event trigger will be applied after those.

* [REF-2273] Implement `.setvar` special EventHandler

All State subclasses will now have a special `setvar` EventHandler which
appears in the autocomplete drop down, passes static analysis, and canbe used
to set State Vars in response to event triggers.

Before:
    rx.input(value=State.a, on_change=State.set_a)

After:
    rx.input(value=State.a, on_change=State.setvar("a"))

This reduces the "magic" because `setvar` is statically defined on all State
subclasses.

* Catch invalid Var names and types at compile time

* Add test cases for State.setvar

* Use a proper redis-compatible token
2024-05-01 17:13:55 -07:00
..
compiler ruff-format: unify Black with Ruff v0.1 (#2837) 2024-04-23 14:40:06 -07:00
components Update CodeBlock class to accept rx.color in custom_style (#3168) 2024-05-01 14:48:33 -07:00
middleware [REF-201] Separate on_load handler from initial hydration (#1847) 2023-11-30 12:21:15 -08:00
states RED-1052/rx.State as Base State (#2146) 2023-11-29 09:43:33 -08:00
utils allow optional props with None default value (#3179) 2024-05-01 13:33:38 -07:00
__init__.py RED-1052/rx.State as Base State (#2146) 2023-11-29 09:43:33 -08:00
conftest.py [REF-201] Separate on_load handler from initial hydration (#1847) 2023-11-30 12:21:15 -08:00
test_app.py [REF-2392] Expose next.config.js transpilePackages key (#3006) 2024-04-11 13:50:42 -07:00
test_attribute_access_type.py Improved get_attribute_access_type tests (#3180) 2024-05-01 17:13:23 -07:00
test_base.py Rename pynecone to reflex (#1236) 2023-06-25 16:56:55 -07:00
test_config.py Added Environmental variable REFLEX_DIR (#2457) 2024-01-30 18:18:29 -08:00
test_db_config.py Rename pynecone to reflex (#1236) 2023-06-25 16:56:55 -07:00
test_event.py [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
test_init.py Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
test_model.py supply default for sqlmodel PK for both DB and python to work (#1788) 2023-09-08 14:51:57 -07:00
test_prerequisites.py [REF-2392] Expose next.config.js transpilePackages key (#3006) 2024-04-11 13:50:42 -07:00
test_route.py Allow underscores in routes (#1713) 2023-09-08 12:18:33 -07:00
test_state_tree.py [REF-1988] API to Get instance of Arbitrary State class (#2678) 2024-02-27 13:02:08 -08:00
test_state.py [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
test_style.py Handle component namespaces in global styles (#2630) 2024-02-15 16:03:10 -08:00
test_telemetry.py telemetry refactor + unit tests (#2786) 2024-03-13 12:38:54 -07:00
test_testing.py Avoid passing props to lists and list items (#2326) 2023-12-21 15:58:45 -08:00
test_var.py allow set in var.contains (#3113) 2024-04-18 20:00:18 -07:00