Skip to content
Snippets Groups Projects
Commit 127cdafb authored by Jack Reed's avatar Jack Reed
Browse files

Backfill tests for miradorAnnotationPlugin

parent 7be6e7da
No related branches found
No related tags found
No related merge requests found
...@@ -8,9 +8,11 @@ import AnnotationCreation from '../src/AnnotationCreation'; ...@@ -8,9 +8,11 @@ import AnnotationCreation from '../src/AnnotationCreation';
function createWrapper(props) { function createWrapper(props) {
return shallow( return shallow(
<miradorAnnotationPlugin.component <miradorAnnotationPlugin.component
config={{}}
TargetComponent={'<div>hello</div>'} TargetComponent={'<div>hello</div>'}
targetProps={{}} targetProps={{}}
addCompanionWindow={jest.fn()} addCompanionWindow={jest.fn()}
receiveAnnotation={jest.fn()}
{...props} {...props}
/>, />,
); );
...@@ -24,14 +26,22 @@ describe('MiradorAnnotation', () => { ...@@ -24,14 +26,22 @@ describe('MiradorAnnotation', () => {
}); });
it('opens a new companionWindow when clicked', () => { it('opens a new companionWindow when clicked', () => {
const mockAddCompanionWindow = jest.fn(); const mockAddCompanionWindow = jest.fn();
const receiveAnnotationMock = jest.fn();
wrapper = createWrapper({ wrapper = createWrapper({
addCompanionWindow: mockAddCompanionWindow, addCompanionWindow: mockAddCompanionWindow,
receiveAnnotation: receiveAnnotationMock,
}); });
wrapper.find(MiradorMenuButton).simulate('click'); wrapper.find(MiradorMenuButton).simulate('click');
expect(mockAddCompanionWindow).toHaveBeenCalledWith( expect(mockAddCompanionWindow).toHaveBeenCalledWith(
'custom', 'custom',
{ {
children: <AnnotationCreation />, children: (
<AnnotationCreation
canvases={[]}
config={{}}
receiveAnnotation={receiveAnnotationMock}
/>
),
position: 'right', position: 'right',
title: 'New annotation', title: 'New annotation',
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment