/** @jsxImportSource @compiled/react */ import { render } from '@testing-library/react'; describe('css prop', () => { it('should create css from object literal', () => { const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '15px'); }); it('should use string literal with identifier', () => { const fontSize = 12; const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); it('should create css from string literal', () => { const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); it('should not type error with nested selectors', () => {
hello world
; }); it('should create css from string', () => { const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); it('should create css from object reference', () => { const base = { fontSize: 12 }; const { getByText } = render(
hello world
); 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(
hello world
); 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(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); it('should create css from arrow function', () => { const base = () => ({ fontSize: 13 }); const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px'); }); it('should create css from array', () => { const base = { fontSize: 12 }; const next = ` font-size: 15px; `; const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '15px'); }); it('should remove duplicate declarations', () => { const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '20px'); expect(getByText('hello world')).not.toHaveCompiledCss('font-size', '12px'); }); it('should create css from object reference with true condition', () => { const condition = true; const base = { fontSize: 12 }; const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); it('should create css from object reference with false condition', () => { const condition = false; const base = { fontSize: 12 }; const { getByText } = render(
hello world
); expect(getByText('hello world')).not.toHaveCompiledCss('font-size', '12px'); }); it('should create css from array of object reference with condition', () => { const condition = true; const base = { fontSize: 12 }; const base2 = { fontSize: 20 }; const { getByText } = render(
hello world
); expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px'); }); });