docbrown/app/javascript/article-form/components/__tests__/Close.test.jsx
Viviane Dias 27373c6cf8
Improves UI unit tests by correcting wrong use of queries (#17599)
* test(cover-image): uses correct queries for ui unit tests

* test(form): replaces queries to getByRole and adds expect where necessary

* feat(help): adds expect assert and uses within to test inside specific block

* feat(image-uploader): uses correct queries to validate behaviour

* test: corrects queries and adds expect assertions to some unit tests
2022-05-09 14:23:56 +01:00

20 lines
604 B
JavaScript

import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import '@testing-library/jest-dom';
import { Close } from '../Close';
describe('<Close />', () => {
it('should have no a11y violations', async () => {
const { container } = render(<Close />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('renders the close button', () => {
const { getByRole } = render(<Close />);
const icon = getByRole('button', { name: /Close the editor/i });
expect(icon).toBeInTheDocument();
});
});