import axe from '../../../../axe-helper';
import React from 'react';
import { render } from '@testing-library/react';
import Button from './Button';
describe('', () => {
it('renders with no a11y violations', async () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
const results = await axe(container.innerHTML);
expect(results).toHaveNoViolations();
});
it('renders as "secondary"', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('renders as "link"', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('renders disabled', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('renders wide', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('renders loading as "primary"', () => {
const { container } = render();
expect(container.firstChild).toMatchSnapshot();
});
it('renders loading as "secondary"', () => {
const { container } = render(
,
);
expect(container.firstChild).toMatchSnapshot();
});
it('renders loading as "secondary"', () => {
const { container } = render(
,
);
expect(container.firstChild).toMatchSnapshot();
});
it('renders loading with disabled attribute', () => {
const { container } = render();
expect(container.firstChild).toHaveAttribute('disabled');
});
it.each`
type
${'submit'}
${'reset'}
${'button'}
`('renders with the specified type: $type', ({ type }) => {
const { getByText } = render();
const target = getByText('Foo');
expect(target.getAttribute('type')).toEqual(type);
});
});