reflex/tests
Masen Furer 3715462eb4
Allow Component.add_style to return a regular dict (#3264)
* Allow `Component.add_style` to return a regular dict

It's more convenient to allow returning a regular dict without having to import
and wrap the value in `rx.style.Style`.

If the dict contains any Var or encoded VarData f-strings, these will be picked
up when the plain dicts are passed to Style.update().

Because Style.update already merges VarData, there is no reason to explicitly
merge it again in this function; this change keeps the merging logic inside the
Style class.

* Test for Style.update with existing Style with _var_data and kwargs

Should retain the _var_data from the original Style instance

* style: Avoid losing VarData in Style.update

If a Style class with _var_data is passed to `Style.update` along with kwargs,
then the _var_data was lost in the double-splat dictionary expansion.

Instead, only apply the kwargs to an existing or new Style instance to retain
_var_data and properly convert values.

* add_style return annotation is Dict[str, Any]

* nit: use lowercase dict in annotation
2024-05-10 20:25:04 -07:00
..
compiler Remove deprecations for 0.5.0 (#3222) 2024-05-07 08:55:42 -07:00
components Allow Component.add_style to return a regular dict (#3264) 2024-05-10 20:25:04 -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-2643] Throw Errors for duplicate Routes (#3155) 2024-05-03 12:15:40 -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 Clean up config and app API (#3197) 2024-05-02 18:15:28 -07: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 [REF-2658] Alembic should use batch mode for autogenerate (#3223) 2024-05-06 18:34:55 -07:00
test_prerequisites.py [REF-2676][REF-2751] Windows Skip ARM devices on bun install + Telemetry (#3212) 2024-05-06 09:50:05 -07:00
test_route.py [REF-2643] Throw Errors for duplicate Routes (#3155) 2024-05-03 12:15:40 -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 Remove deprecations for 0.5.0 (#3222) 2024-05-07 08:55:42 -07:00
test_style.py Allow Component.add_style to return a regular dict (#3264) 2024-05-10 20:25:04 -07:00
test_telemetry.py [REF-2676][REF-2751] Windows Skip ARM devices on bun install + Telemetry (#3212) 2024-05-06 09:50:05 -07:00
test_testing.py Clean up config and app API (#3197) 2024-05-02 18:15:28 -07:00
test_var.py allow set in var.contains (#3113) 2024-04-18 20:00:18 -07:00