Skip to content

Commit

Permalink
test(shaker): add a failed test for issue 1141 (#1151)
Browse files Browse the repository at this point in the history
  • Loading branch information
chentsulin committed Jan 6, 2023
1 parent d11174d commit 2ed729e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/testkit/src/__snapshots__/babel.test.ts.snap
Expand Up @@ -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\\";
Expand Down
19 changes: 19 additions & 0 deletions packages/testkit/src/babel.test.ts
Expand Up @@ -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`
Expand Down

0 comments on commit 2ed729e

Please sign in to comment.