import React from 'react'; import 'jest-styled-components'; import 'jest-axe/extend-expect'; import 'regenerator-runtime/runtime'; import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { axe } from 'jest-axe'; import { Grommet } from '../../Grommet'; import { Cards } from '..'; import { Card } from '../../Card'; import { CardHeader } from '../../CardHeader'; const data: string[] = []; for (let i = 0; i < 95; i += 1) { data.push(`entry-${i}`); } describe('Cards', () => { test('should have no accessibility violations', async () => { const { container } = render( , ); const results = await axe(container); expect(results).toHaveNoViolations(); }); test('renders a11yTitle and aria-label', () => { const { container, getByLabelText } = render( , ); expect(getByLabelText('test')).toBeTruthy(); expect(getByLabelText('test-2')).toBeTruthy(); expect(container).toMatchSnapshot(); }); test('empty', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('data strings', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('data objects', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('children render', () => { const { container } = render( {(item, index) => ( `${item} - ${index}` )} , ); expect(container.firstChild).toMatchSnapshot(); }); test('margin string', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('margin object', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('pad string', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); test('pad object', () => { const { container } = render( , ); expect(container.firstChild).toMatchSnapshot(); }); });