diff --git a/packages/testkit/src/__snapshots__/babel.test.ts.snap b/packages/testkit/src/__snapshots__/babel.test.ts.snap index b8d693071..3be64dfa3 100644 --- a/packages/testkit/src/__snapshots__/babel.test.ts.snap +++ b/packages/testkit/src/__snapshots__/babel.test.ts.snap @@ -1257,6 +1257,31 @@ Dependencies: NA `; +exports[`strategy shaker handles interpolation in css function followed by unit 1`] = ` +"import { styled } from '@linaria/atomic'; +const _exp = /*#__PURE__*/() => props => props.$rotateDeg; +export const Container = /*#__PURE__*/styled('div')({ + name: \\"Container\\", + class: \\"atm_tr_18309cv atm_vy_1783zgq Container_c13jq05\\", + propsAsIs: false, + vars: { + \\"y6125t\\": [_exp(), \\"deg\\"] + }, + atomic: true +});" +`; + +exports[`strategy shaker handles interpolation in css function followed by unit 2`] = ` + +CSS: + +.atm_tr_18309cv{transform:rotate(var(--y6125t));} +.atm_vy_1783zgq{width:200;px;} + +Dependencies: NA + +`; + exports[`strategy shaker handles nested blocks 1`] = ` "import { styled } from '@linaria/react'; const regular = () => \\"arial\\"; diff --git a/packages/testkit/src/babel.test.ts b/packages/testkit/src/babel.test.ts index c91780f68..001569884 100644 --- a/packages/testkit/src/babel.test.ts +++ b/packages/testkit/src/babel.test.ts @@ -721,6 +721,25 @@ describe('strategy shaker', () => { expect(metadata).toMatchSnapshot(); }); + it('handles interpolation in css function followed by unit', async () => { + const { code, metadata } = await transform( + dedent` + import { styled } from '@linaria/atomic'; + + const size = 200; + + export const Container = styled.div\` + transform: rotate(${'${props => props.$rotateDeg}'}deg); + width: ${'${size}'}px; + \`; + `, + [evaluator] + ); + + expect(code).toMatchSnapshot(); + expect(metadata).toMatchSnapshot(); + }); + it('uses the same custom property for the same identifier', async () => { const { code, metadata } = await transform( dedent`