followup for merge style PR (#4721)
This commit is contained in:
parent
12bda1d4f5
commit
87d93b33b8
@ -303,8 +303,16 @@ class Style(dict):
|
||||
Returns:
|
||||
The combined style.
|
||||
"""
|
||||
_var_data = VarData.merge(self._var_data, getattr(other, "_var_data", None))
|
||||
return Style(super().__or__(self, other), _var_data=_var_data) # pyright: ignore [reportGeneralTypeIssues, reportCallIssue]
|
||||
other_var_data = None
|
||||
if not isinstance(other, Style):
|
||||
other_dict, other_var_data = convert(other)
|
||||
else:
|
||||
other_dict, other_var_data = other, other._var_data
|
||||
|
||||
new_style = Style(super().__or__(other_dict))
|
||||
if self._var_data or other_var_data:
|
||||
new_style._var_data = VarData.merge(self._var_data, other_var_data)
|
||||
return new_style
|
||||
|
||||
|
||||
def _format_emotion_style_pseudo_selector(key: str) -> str:
|
||||
|
@ -541,3 +541,7 @@ def test_style_update_with_var_data():
|
||||
assert s2._var_data is not None
|
||||
assert "const red = true" in s2._var_data.hooks
|
||||
assert "const blue = true" in s2._var_data.hooks
|
||||
|
||||
s3 = s1 | s2
|
||||
assert s3._var_data is not None
|
||||
assert "_varData" not in s3
|
||||
|
Loading…
Reference in New Issue
Block a user