Skip to content

Commit

Permalink
Add test case (#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
dddlr authored May 15, 2024
1 parent 5c04f89 commit b47c747
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/babel-plugin/src/__tests__/expression-evaluation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,25 @@ describe('import specifiers', () => {
expect(actual).toInclude('@media screen{._434713q2{color:blue}}');
});

it('handles the computed object property, where the variable in property is defined inside `as const` expression', () => {
const actual = transform(
`
import '@compiled/react';
const something = { large: '@media screen' } as const;
<div css={{
[something.large]: { color: 'blue' },
}} />
`,
{
parserBabelPlugins: ['typescript', 'jsx'],
}
);

expect(actual).toInclude('@media screen{._434713q2{color:blue}}');
});

it('uses fallback node when evaluating a non expression returning a non static value', () => {
const actual = transform(`
import '@compiled/react';
Expand Down

0 comments on commit b47c747

Please sign in to comment.