Skip to content

Commit f349656

Browse files
committed
add fixtures for a few object interpolation cases
1 parent 8183ad8 commit f349656

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

test/fixtures/transpile-css-prop/code.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,29 @@ const EarlyUsageComponent = p => <Thing3 css="color: red;" />
106106
const Thing3 = styled.div`
107107
color: blue;
108108
`
109+
110+
const ObjectInterpolation = p => {
111+
const theme = useTheme()
112+
113+
return (
114+
<p
115+
css={{
116+
color: theme.colors.red,
117+
}}
118+
>
119+
H
120+
</p>
121+
)}
122+
123+
const ObjectInterpolationCustomComponent = p => {
124+
const theme = useTheme()
125+
126+
return (
127+
<Thing3
128+
css={{
129+
color: theme.colors.red,
130+
}}
131+
>
132+
H
133+
</Thing3>
134+
)}

test/fixtures/transpile-css-prop/output.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,30 @@ var EarlyUsageComponent = function EarlyUsageComponent(p) {
147147

148148
var Thing3 = styled.div(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n color: blue;\n"])));
149149

150+
var _StyledThing2 = (0, _styledComponents["default"])(Thing3)(function (p) {
151+
return {
152+
color: p._css5
153+
};
154+
});
155+
150156
var _StyledThing = (0, _styledComponents["default"])(Thing3)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["color: red;"])));
157+
158+
var _StyledP12 = (0, _styledComponents["default"])("p")(function (p) {
159+
return {
160+
color: p._css4
161+
};
162+
});
163+
164+
var ObjectInterpolation = function ObjectInterpolation(p) {
165+
var theme = useTheme();
166+
return <_StyledP12 _css4={theme.colors.red}>
167+
H
168+
</_StyledP12>;
169+
};
170+
171+
var ObjectInterpolationCustomComponent = function ObjectInterpolationCustomComponent(p) {
172+
var theme = useTheme();
173+
return <_StyledThing2 _css5={theme.colors.red}>
174+
H
175+
</_StyledThing2>;
176+
};

0 commit comments

Comments
 (0)