Skip to content

Commit

Permalink
chore: add two test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdouges committed Apr 26, 2020
1 parent 0fdfa3a commit 749c7a4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/css-in-js/src/jsx/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '@compiled/css-in-js';
import React from 'react';
import { render } from '@testing-library/react';
import '@compiled/jest-css-in-js';

describe('css prop', () => {
it('should create css from object literal', () => {
Expand Down Expand Up @@ -72,6 +73,34 @@ describe('css prop', () => {
expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
});

it('should create css from object reference in templatel literal', () => {
const base = { fontSize: 12 };
const { getByText } = render(
<div
css={`
${base}
`}>
hello world
</div>
);

expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
});

it('should create css from arrow func in templatel literal', () => {
const base = () => ({ fontSize: 12 });
const { getByText } = render(
<div
css={`
${base()}
`}>
hello world
</div>
);

expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
});

it('should create css from arrow function', () => {
const base = () => ({ fontSize: 12 });
const { getByText } = render(<div css={{ ...base() }}>hello world</div>);
Expand Down

0 comments on commit 749c7a4

Please sign in to comment.