/** * @jsxImportSource react * @jest-environment jsdom */ import { render } from '@theme-ui/test-utils' import { ThemeProvider } from '@theme-ui/core' import { matchers } from '@emotion/jest' import { Themed } from '../src' expect.extend(matchers) describe(Themed.div.name, () => { it('accepts .sx prop', async () => { const tree = render( blue text ) const div = await tree.findByText('blue text') const style = global.getComputedStyle(div) expect(style.color).toBe('blue') }) }) describe(`${Themed.td.name} and ${Themed.th.name}`, () => { it('maps "align" prop to "text-align" style', async () => { const tree = render( Left Center Right TextLeft TextCenter TextRight ) expect(tree.getByText('Left')).toHaveStyleRule('text-align', 'left') expect(tree.getByText('Center')).toHaveStyleRule('text-align', 'center') expect(tree.getByText('Right')).toHaveStyleRule('text-align', 'right') expect(tree.getByText('TextLeft')).toHaveStyleRule('text-align', 'left') expect(tree.getByText('TextCenter')).toHaveStyleRule('text-align', 'center') expect(tree.getByText('TextRight')).toHaveStyleRule('text-align', 'right') }) })