import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import ModalBackground from '../components/ModalBackground';
describe('', () => {
const defaultProps = {
onClick: () => {
return 'onClick';
},
};
it('should have no a11y violations', async () => {
const { container } = render();
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should render', () => {
const { queryByTestId } = render();
expect(queryByTestId('listings-modal-background')).toBeDefined();
});
it('should call the onClick handler', () => {
const onClick = jest.fn();
const { getByTestId } = render(
,
);
const modalBackground = getByTestId('listings-modal-background');
modalBackground.click();
expect(onClick).toHaveBeenCalledTimes(1);
});
});