-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathAnnotationSettings.test.jsx
More file actions
34 lines (28 loc) · 968 Bytes
/
AnnotationSettings.test.jsx
File metadata and controls
34 lines (28 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { render, screen } from '@tests/utils/test-utils';
import userEvent from '@testing-library/user-event';
import { AnnotationSettings } from '../../../src/components/AnnotationSettings';
/** */
function createWrapper(props) {
return render(
<AnnotationSettings
displayAll={false}
displayAllDisabled={false}
toggleAnnotationDisplay={() => {}}
windowId="abc123"
{...props}
/>,
);
}
describe('AnnotationSettings', () => {
const toggleAnnotationDisplayMock = vi.fn();
it('renders a MiradorMenuButton', () => {
createWrapper();
expect(screen.getByRole('button')).toBeInTheDocument();
});
it('calls the toggleAnnotationDisplay prop function on click', async () => {
const user = userEvent.setup();
createWrapper({ toggleAnnotationDisplay: toggleAnnotationDisplayMock });
await user.click(screen.getByRole('button'));
expect(toggleAnnotationDisplayMock).toHaveBeenCalledTimes(1);
});
});