docbrown/app/javascript/listings/__tests__/ClearQueryButton.test.jsx
Katie Davis 76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00

23 lines
727 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import { ClearQueryButton } from '../components/ClearQueryButton';
describe('<ClearQueryButton />', () => {
it('has no a11y violations', async () => {
const { container } = render(<ClearQueryButton onClick={jest.fn()} />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should fire a click event when pressed', () => {
const onClickHandler = jest.fn();
const { getByText } = render(<ClearQueryButton onClick={onClickHandler} />);
const button = getByText('×');
button.click();
expect(onClickHandler).toHaveBeenCalledTimes(1);
});
});