// eslint-disable-next-line import/no-extraneous-dependencies
import { ClassNames } from '@compiled/react';
import { render } from '@testing-library/react';
import React from 'react';
describe('class names component', () => {
it('should create css from object literal', () => {
const { getByText } = render(
{({ css }) => hello world
}
);
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
});
it('should create css from template literal', () => {
const { getByText } = render(
{({ css }) => (
hello world
)}
);
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
});
it('should create css from template literal', () => {
const fontSize = 12;
const { getByText } = render(
{({ css, style }) => (
hello world
)}
);
expect(getByText('hello world')).toHaveCompiledCss('font-size', '12px');
});
it('should not type error with nested selectors', () => {
{({ css }) => (
hello world
)}
;
});
it('should create css from string literal', () => {
const { getByText } = render(
{({ css }) => hello world
}
);
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
});
it('should reference an identifier', () => {
const primary = 'blue';
const { getByText } = render(
{({ css, style }) => (
hello world
)}
);
expect(getByText('hello world')).toHaveCompiledCss('color', 'blue');
});
it('should create css from array literal', () => {
const base = { fontSize: 12 };
const next = `font-size: 13px`;
const { getByText } = render(
{({ css }) => hello world
}
);
expect(getByText('hello world')).toHaveCompiledCss('font-size', '13px');
});
it('should accept css args', () => {
const { getByText } = render(
{({ css }) => (
hello world
)}
);
expect(getByText('hello world')).toHaveCompiledCss({
fontSize: '15px',
color: 'red',
display: 'none',
});
});
});