reflex/tests/components
Masen Furer 69d5c02cc5
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:27:40 -07:00
..
base generate pyi files when building/publishing 3rd party component (#2945) 2024-03-29 09:54:21 -07:00
core [REF-2802] Foreach should respect modifications to children (#3263) 2024-05-10 20:27:39 -07:00
datadisplay Top-level namespace tweaks (#2523) 2024-02-05 11:14:02 -08:00
el Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
forms [REF-2574] Default width for Stack (+children) and default padding for container (#3104) 2024-04-30 13:15:57 -07:00
graphing Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
layout generate pyi files when building/publishing 3rd party component (#2945) 2024-03-29 09:54:21 -07:00
lucide add_style api (#3202) 2024-05-06 16:59:11 -07:00
media Use rx.el.img as rx.image (#2558) 2024-02-08 14:44:53 -08:00
radix add_style api (#3202) 2024-05-06 16:59:11 -07:00
typography Remove deprecations for 0.5.0 (#3222) 2024-05-07 08:55:42 -07:00
__init__.py Add basic unit tests (#7) 2022-11-20 14:34:25 -08:00
test_component_future_annotations.py [REF-2272] Support declaring EventHandlers directly in component (#2952) 2024-03-29 06:26:07 -07:00
test_component_state.py [REF-2265] ComponentState: scaffold for copying State per Component instance (#2923) 2024-03-29 09:22:25 -07:00
test_component.py Allow Component.add_style to return a regular dict (#3264) 2024-05-10 20:27:40 -07:00
test_tag.py fixed issue with hypens (#2450) 2024-01-26 14:14:46 -08:00