diff --git a/src/lib/AnnotationControls.ts b/src/lib/AnnotationControls.ts index d22f6a123..0faff5dfd 100644 --- a/src/lib/AnnotationControls.ts +++ b/src/lib/AnnotationControls.ts @@ -16,12 +16,11 @@ export enum AnnotationMode { NONE = 'none', REGION = 'region', } -export type ClickHandler = ({ event }: { event: MouseEvent }) => void; +export type ClickHandler = ({ event, mode }: { event: MouseEvent; mode: AnnotationMode }) => void; export type Options = { fileId: string; + onClick?: ClickHandler; onEscape?: () => void; - onHighlightClick?: ClickHandler; - onRegionClick?: ClickHandler; showHighlightText: boolean; }; @@ -155,21 +154,6 @@ export default class AnnotationControls { this.updateButton(mode); } - /** - * Annotation control button click handler - */ - private handleClick = (onClick: ClickHandler, mode: AnnotationMode) => (event: MouseEvent): void => { - const prevMode = this.currentMode; - this.resetControls(); - - if (prevMode !== mode) { - this.currentMode = mode as AnnotationMode; - this.updateButton(mode); - } - - onClick({ event }); - }; - /** * Escape key handler, reset all control buttons, * and stop propagation to prevent preview modal from exiting @@ -186,7 +170,7 @@ export default class AnnotationControls { event.stopPropagation(); }; - private addButton = (mode: AnnotationMode, handler: ClickHandler, parent: HTMLElement, fileId: string): void => { + private addButton = (mode: AnnotationMode, onClick: ClickHandler, parent: HTMLElement, fileId: string): void => { const buttonProps = buttonPropsMap[mode]; if (!buttonProps) { @@ -195,7 +179,7 @@ export default class AnnotationControls { const buttonElement = this.controls.add( buttonProps.text, - this.handleClick(handler, mode), + (event: MouseEvent) => onClick({ event, mode }), buttonProps.classname, buttonProps.icon, 'button', @@ -210,22 +194,16 @@ export default class AnnotationControls { /** * Initialize the annotation controls with options. */ - public init({ - fileId, - onEscape = noop, - onRegionClick = noop, - onHighlightClick = noop, - showHighlightText = false, - }: Options): void { + public init({ fileId, onEscape = noop, onClick = noop, showHighlightText = false }: Options): void { if (this.hasInit) { return; } const groupElement = this.controls.addGroup(CLASS_ANNOTATIONS_GROUP); groupElement.setAttribute('data-resin-feature', 'annotations'); - this.addButton(AnnotationMode.REGION, onRegionClick, groupElement, fileId); + this.addButton(AnnotationMode.REGION, onClick, groupElement, fileId); if (showHighlightText) { - this.addButton(AnnotationMode.HIGHLIGHT, onHighlightClick, groupElement, fileId); + this.addButton(AnnotationMode.HIGHLIGHT, onClick, groupElement, fileId); } this.onEscape = onEscape; diff --git a/src/lib/AnnotationControlsFSM.ts b/src/lib/AnnotationControlsFSM.ts new file mode 100644 index 000000000..d2657b349 --- /dev/null +++ b/src/lib/AnnotationControlsFSM.ts @@ -0,0 +1,71 @@ +import { AnnotationMode } from './AnnotationControls'; + +export enum AnnotationState { + HIGHLIGHT = 'highlight', + HIGHLIGHT_TEMP = 'highlight_temp', + NONE = 'none', + REGION = 'region', + REGION_TEMP = 'region_temp', +} + +export enum AnnotationInput { + CANCEL = 'cancel', + CLICK = 'click', + CREATE = 'create', + SUCCESS = 'success', + UPDATE = 'update', +} + +export const modeStateMap = { + [AnnotationMode.HIGHLIGHT]: AnnotationState.HIGHLIGHT, + [AnnotationMode.NONE]: AnnotationState.NONE, + [AnnotationMode.REGION]: AnnotationState.REGION, +}; + +export const modeTempStateMap = { + [AnnotationMode.HIGHLIGHT]: AnnotationState.HIGHLIGHT_TEMP, + [AnnotationMode.NONE]: AnnotationState.NONE, + [AnnotationMode.REGION]: AnnotationState.REGION_TEMP, +}; + +export const stateModeMap = { + [AnnotationState.HIGHLIGHT]: AnnotationMode.HIGHLIGHT, + [AnnotationState.HIGHLIGHT_TEMP]: AnnotationMode.HIGHLIGHT, + [AnnotationState.NONE]: AnnotationMode.NONE, + [AnnotationState.REGION]: AnnotationMode.REGION, + [AnnotationState.REGION_TEMP]: AnnotationMode.REGION, +}; + +export default class AnnotationControlsFSM { + private currentState: AnnotationState; + + constructor(initialState = AnnotationState.NONE) { + this.currentState = initialState; + } + + public getState = (): AnnotationState => this.currentState; + + public transition = (input: AnnotationInput, mode: AnnotationMode = AnnotationMode.NONE): AnnotationMode => { + if (input === AnnotationInput.CLICK) { + this.currentState = mode === stateModeMap[this.currentState] ? AnnotationState.NONE : modeStateMap[mode]; + return stateModeMap[this.currentState]; + } + + switch (this.currentState) { + case AnnotationState.NONE: + if (input === AnnotationInput.CREATE) { + this.currentState = modeTempStateMap[mode] || AnnotationState.NONE; + } + break; + case AnnotationState.HIGHLIGHT_TEMP: + case AnnotationState.REGION_TEMP: + if (input === AnnotationInput.CANCEL || input === AnnotationInput.SUCCESS) { + this.currentState = AnnotationState.NONE; + } + break; + default: + } + + return stateModeMap[this.currentState]; + }; +} diff --git a/src/lib/__tests__/AnnotationControls-test.js b/src/lib/__tests__/AnnotationControls-test.js index dc04e4524..69374c3b0 100644 --- a/src/lib/__tests__/AnnotationControls-test.js +++ b/src/lib/__tests__/AnnotationControls-test.js @@ -4,7 +4,6 @@ import AnnotationControls, { AnnotationMode, CLASS_ANNOTATIONS_BUTTON, CLASS_ANNOTATIONS_GROUP, - CLASS_BUTTON_ACTIVE, CLASS_GROUP_HIDE, CLASS_REGION_BUTTON, } from '../AnnotationControls'; @@ -24,8 +23,7 @@ describe('lib/AnnotationControls', () => { fixture.load('__tests__/AnnotationControls-test.html'); stubs.classListAdd = sandbox.stub(); stubs.classListRemove = sandbox.stub(); - stubs.onHighlightClick = sandbox.stub(); - stubs.onRegionClick = sandbox.stub(); + stubs.onClick = sandbox.stub(); stubs.querySelector = sandbox.stub().returns({ classList: { add: stubs.classListAdd, @@ -84,22 +82,22 @@ describe('lib/AnnotationControls', () => { }); it('should only add region button', () => { - annotationControls.init({ fileId: '0', onRegionClick: stubs.onRegionClick }); + annotationControls.init({ fileId: '0', onClick: stubs.onClick }); expect(annotationControls.addButton).to.be.calledOnceWith( AnnotationMode.REGION, - stubs.onRegionClick, + stubs.onClick, sinon.match.any, '0', ); }); it('should add highlight button', () => { - annotationControls.init({ fileId: '0', onHighlightClick: stubs.onHighlightClick, showHighlightText: true }); + annotationControls.init({ fileId: '0', onClick: stubs.onClick, showHighlightText: true }); expect(annotationControls.addButton).to.be.calledWith( AnnotationMode.HIGHLIGHT, - stubs.onHighlightClick, + stubs.onClick, sinon.match.any, '0', ); @@ -166,32 +164,6 @@ describe('lib/AnnotationControls', () => { }); }); - describe('handleClick()', () => { - beforeEach(() => { - stubs.event = sandbox.stub({}); - }); - - it('should activate region button then deactivate', () => { - expect(annotationControls.currentMode).to.equal(AnnotationMode.NONE); - - annotationControls.handleClick(stubs.onRegionClick, AnnotationMode.REGION)(stubs.event); - expect(annotationControls.currentMode).to.equal(AnnotationMode.REGION); - expect(stubs.classListAdd).to.be.calledWith(CLASS_BUTTON_ACTIVE); - - annotationControls.handleClick(stubs.onRegionClick, AnnotationMode.REGION)(stubs.event); - expect(annotationControls.currentMode).to.equal(AnnotationMode.NONE); - expect(stubs.classListRemove).to.be.calledWith(CLASS_BUTTON_ACTIVE); - }); - - it('should call onRegionClick', () => { - annotationControls.handleClick(stubs.onRegionClick, AnnotationMode.REGION)(stubs.event); - - expect(stubs.onRegionClick).to.be.calledWith({ - event: stubs.event, - }); - }); - }); - describe('resetControls()', () => { beforeEach(() => { sandbox.stub(annotationControls, 'updateButton'); @@ -233,9 +205,7 @@ describe('lib/AnnotationControls', () => { stubs.buttonElement = { setAttribute: sandbox.stub(), }; - stubs.clickHandler = sandbox.stub(); - sandbox.stub(annotationControls, 'handleClick').returns(stubs.clickHandler); sandbox.stub(annotationControls.controls, 'add').returns(stubs.buttonElement); }); @@ -250,7 +220,7 @@ describe('lib/AnnotationControls', () => { expect(annotationControls.controls.add).to.be.calledWith( __('region_comment'), - stubs.clickHandler, + sinon.match.func, `${CLASS_ANNOTATIONS_BUTTON} ${CLASS_REGION_BUTTON}`, ICON_REGION_COMMENT, 'button', diff --git a/src/lib/__tests__/AnnotationControlsFSM-test.js b/src/lib/__tests__/AnnotationControlsFSM-test.js new file mode 100644 index 000000000..523561566 --- /dev/null +++ b/src/lib/__tests__/AnnotationControlsFSM-test.js @@ -0,0 +1,194 @@ +import AnnotationControlsFSM, { AnnotationInput, AnnotationState } from '../AnnotationControlsFSM'; +import { AnnotationMode } from '../AnnotationControls'; + +describe('lib/AnnotationControlsFSM', () => { + describe('AnnotationState.NONE', () => { + // Go to different states + [ + { + input: AnnotationInput.CLICK, + mode: AnnotationMode.HIGHLIGHT, + nextState: AnnotationState.HIGHLIGHT, + output: AnnotationMode.HIGHLIGHT, + }, + { + input: AnnotationInput.CLICK, + mode: AnnotationMode.REGION, + nextState: AnnotationState.REGION, + output: AnnotationMode.REGION, + }, + { + input: AnnotationInput.CREATE, + mode: AnnotationMode.HIGHLIGHT, + nextState: AnnotationState.HIGHLIGHT_TEMP, + output: AnnotationMode.HIGHLIGHT, + }, + { + input: AnnotationInput.CREATE, + mode: AnnotationMode.REGION, + nextState: AnnotationState.REGION_TEMP, + output: AnnotationMode.REGION, + }, + ].forEach(({ input, mode, nextState, output }) => { + it(`should go to state ${nextState} and output ${output} if input is ${input} and mode is ${mode}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(); + + expect(annotationControlsFSM.transition(input, mode)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(nextState); + }); + }); + + // Stay in the same state + [AnnotationInput.CANCEL, AnnotationInput.SUCCESS, AnnotationInput.UPDATE].forEach(input => { + it(`should stay in state none if input is ${input}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(); + + expect(annotationControlsFSM.transition(input)).to.equal(AnnotationMode.NONE); + expect(annotationControlsFSM.getState()).to.equal(AnnotationState.NONE); + }); + }); + }); + + describe('AnnotationState.HIGHLIGHT/REGION', () => { + // Stay in the same state + [AnnotationState.HIGHLIGHT, AnnotationState.REGION].forEach(state => { + [AnnotationInput.CANCEL, AnnotationInput.CREATE, AnnotationInput.SUCCESS, AnnotationInput.SUCCESS].forEach( + input => { + it(`should stay in state ${state} if input is ${input}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(state); + + expect(annotationControlsFSM.transition(input)).to.equal(state); + expect(annotationControlsFSM.getState()).to.equal(state); + }); + }, + ); + }); + + // Go to different states + describe('AnnotationState.HIGHLIGHT', () => { + [ + { + mode: AnnotationMode.HIGHLIGHT, + output: AnnotationMode.NONE, + }, + { + mode: AnnotationMode.REGION, + output: AnnotationMode.REGION, + }, + ].forEach(({ mode, output }) => { + it(`should output ${output} if input is click and mode is ${mode}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(AnnotationState.HIGHLIGHT); + + expect(annotationControlsFSM.transition(AnnotationInput.CLICK, mode)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(output); + }); + }); + }); + + // Go to different states + describe('AnnotationState.REGION', () => { + [ + { + mode: AnnotationMode.REGION, + output: AnnotationMode.NONE, + }, + { + mode: AnnotationMode.HIGHLIGHT, + output: AnnotationMode.HIGHLIGHT, + }, + ].forEach(({ mode, output }) => { + it(`should output ${output} if input is click and mode is ${mode}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(AnnotationState.REGION); + + expect(annotationControlsFSM.transition(AnnotationInput.CLICK, mode)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(output); + }); + }); + }); + }); + + describe('AnnotationState.HIGHLIGHT_TEMP/REGION_TEMP', () => { + // Go to none state + [ + { + state: AnnotationState.HIGHLIGHT_TEMP, + stateMode: AnnotationMode.HIGHLIGHT, + }, + { + state: AnnotationState.REGION_TEMP, + stateMode: AnnotationMode.REGION, + }, + ].forEach(({ state, stateMode }) => { + [ + { + input: AnnotationInput.CANCEL, + nextState: AnnotationState.NONE, + output: AnnotationMode.NONE, + }, + { + input: AnnotationInput.SUCCESS, + nextState: AnnotationState.NONE, + output: AnnotationMode.NONE, + }, + ].forEach(({ input, nextState, output }) => { + it(`should go to state ${nextState} and output ${output} if input is ${input}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(state); + + expect(annotationControlsFSM.transition(input)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(nextState); + }); + }); + + [AnnotationInput.CREATE, AnnotationInput.UPDATE].forEach(input => { + it(`should stay in state ${state} if input is ${input}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(state); + + expect(annotationControlsFSM.transition(input)).to.equal(stateMode); + expect(annotationControlsFSM.getState()).to.equal(state); + }); + }); + }); + + // Go to different states + describe('AnnotationState.HIGHLIGHT_TEMP', () => { + [ + { + mode: AnnotationMode.HIGHLIGHT, + output: AnnotationMode.NONE, + }, + { + mode: AnnotationMode.REGION, + output: AnnotationMode.REGION, + }, + ].forEach(({ mode, output }) => { + it(`should output ${output} if input is click and mode is ${mode}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(AnnotationState.HIGHLIGHT_TEMP); + + expect(annotationControlsFSM.transition(AnnotationInput.CLICK, mode)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(output); + }); + }); + }); + + // Go to different states + describe('AnnotationState.REGION_TEMP', () => { + [ + { + mode: AnnotationMode.REGION, + output: AnnotationMode.NONE, + }, + { + mode: AnnotationMode.HIGHLIGHT, + output: AnnotationMode.HIGHLIGHT, + }, + ].forEach(({ mode, output }) => { + it(`should output ${output} if input is click and mode is ${mode}`, () => { + const annotationControlsFSM = new AnnotationControlsFSM(AnnotationState.REGION_TEMP); + + expect(annotationControlsFSM.transition(AnnotationInput.CLICK, mode)).to.equal(output); + expect(annotationControlsFSM.getState()).to.equal(output); + }); + }); + }); + }); +}); diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index f27fa85d9..fcac0921e 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -35,6 +35,7 @@ import { EXCLUDED_EXTENSIONS } from '../extensions'; import { getIconFromExtension, getIconFromName } from '../icons/icons'; import { VIEWER_EVENT, ERROR_CODE, LOAD_METRIC, DOWNLOAD_REACHABILITY_METRICS } from '../events'; import { AnnotationMode } from '../AnnotationControls'; +import AnnotationControlsFSM, { AnnotationInput } from '../AnnotationControlsFSM'; import PreviewError from '../PreviewError'; import Timer from '../Timer'; @@ -140,6 +141,8 @@ class BaseViewer extends EventEmitter { this.emittedMetrics = {}; + this.annotationControlsFSM = new AnnotationControlsFSM(); + // Bind context for callbacks this.resetLoadTimeout = this.resetLoadTimeout.bind(this); this.preventDefault = this.preventDefault.bind(this); @@ -151,11 +154,11 @@ class BaseViewer extends EventEmitter { this.mobileZoomEndHandler = this.mobileZoomEndHandler.bind(this); this.handleAnnotatorEvents = this.handleAnnotatorEvents.bind(this); this.handleAnnotationCreateEvent = this.handleAnnotationCreateEvent.bind(this); + this.handleAnnotationControlsClick = this.handleAnnotationControlsClick.bind(this); this.handleAnnotationControlsEscape = this.handleAnnotationControlsEscape.bind(this); + this.handleAnnotationStagedChangeEvent = this.handleAnnotationStagedChangeEvent.bind(this); this.handleFullscreenEnter = this.handleFullscreenEnter.bind(this); this.handleFullscreenExit = this.handleFullscreenExit.bind(this); - this.handleHighlightClick = this.handleHighlightClick.bind(this); - this.handleRegionClick = this.handleRegionClick.bind(this); this.createAnnotator = this.createAnnotator.bind(this); this.viewerLoadHandler = this.viewerLoadHandler.bind(this); this.initAnnotations = this.initAnnotations.bind(this); @@ -1015,6 +1018,7 @@ class BaseViewer extends EventEmitter { if (this.areNewAnnotationsEnabled() && this.annotationControls) { this.annotator.addListener('annotations_create', this.handleAnnotationCreateEvent); + this.annotator.addListener('creator_staged_change', this.handleAnnotationStagedChangeEvent); } } @@ -1069,23 +1073,16 @@ class BaseViewer extends EventEmitter { } /** - * Handler for annotation toolbar highlight text button click event. - * - * @private - * @return {void} - */ - handleHighlightClick() { - this.annotator.toggleAnnotationMode(AnnotationMode.HIGHLIGHT); - } - - /** - * Handler for annotation toolbar region comment button click event. + * Handler for annotation controls button click event. * * @private + * @param {AnnotationMode} mode one of annotation modes * @return {void} */ - handleRegionClick() { - this.annotator.toggleAnnotationMode(AnnotationMode.REGION); + handleAnnotationControlsClick({ mode }) { + const nextMode = this.annotationControlsFSM.transition(AnnotationInput.CLICK, mode); + this.annotator.toggleAnnotationMode(nextMode); + this.annotationControls.setMode(nextMode); } /** @@ -1257,9 +1254,21 @@ class BaseViewer extends EventEmitter { // we remain in create mode if (status === 'success') { this.annotator.emit('annotations_active_set', id); + + if (this.annotationControls) { + this.annotationControls.setMode(this.annotationControlsFSM.transition(AnnotationInput.SUCCESS)); + } } } + handleAnnotationStagedChangeEvent({ status, type }) { + if (!this.annotationControls) { + return; + } + + this.annotationControls.setMode(this.annotationControlsFSM.transition(status, type)); + } + /** * Creates combined options to give to the annotator * diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index 4ef68d72f..2f3c02128 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -1255,6 +1255,10 @@ describe('lib/viewers/BaseViewer', () => { 'annotations_initialized', base.handleAnnotationsInitialized, ); + expect(base.annotator.addListener).to.be.calledWith( + 'creator_staged_change', + base.handleAnnotationStagedChangeEvent, + ); expect(base.emit).to.be.calledWith('annotator', base.annotator); }); @@ -1773,6 +1777,10 @@ describe('lib/viewers/BaseViewer', () => { base.annotator = { emit: sandbox.stub(), }; + base.annotationControls = { + destroy: sandbox.stub(), + setMode: sandbox.stub(), + }; }); const createEvent = status => ({ @@ -1796,6 +1804,19 @@ describe('lib/viewers/BaseViewer', () => { base.handleAnnotationCreateEvent(event); expect(base.annotator.emit).to.be.calledWith('annotations_active_set', '123'); + expect(base.annotationControls.setMode).to.be.calledWith('none'); + }); + }); + + describe('handleAnnotationStagedChangeEvent()', () => { + it('should set mode', () => { + base.annotationControls = { + destroy: sandbox.stub(), + setMode: sandbox.stub(), + }; + base.handleAnnotationStagedChangeEvent({ status: 'create', type: 'highlight' }); + + expect(base.annotationControls.setMode).to.be.calledWith('highlight'); }); }); @@ -1811,15 +1832,23 @@ describe('lib/viewers/BaseViewer', () => { }); }); - describe('handleRegionClick', () => { + describe('handleAnnotationControlsClick', () => { + beforeEach(() => { + base.annotationControls = { + destroy: sandbox.stub(), + setMode: sandbox.stub(), + }; + }); + it('should call toggleAnnotationMode', () => { base.annotator = { toggleAnnotationMode: sandbox.stub(), }; - base.handleRegionClick(); + base.handleAnnotationControlsClick({ mode: 'region' }); expect(base.annotator.toggleAnnotationMode).to.be.calledWith('region'); + expect(base.annotationControls.setMode).to.be.calledWith('region'); }); }); }); diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 3f1bd3474..d677a6521 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -1107,9 +1107,8 @@ class DocBaseViewer extends BaseViewer { if (this.areNewAnnotationsEnabled() && this.hasAnnotationCreatePermission()) { this.annotationControls.init({ fileId: this.options.file.id, + onClick: this.handleAnnotationControlsClick, onEscape: this.handleAnnotationControlsEscape, - onHighlightClick: this.handleHighlightClick, - onRegionClick: this.handleRegionClick, showHighlightText: this.options.showAnnotationsHighlightText, }); } diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index 2f89f861a..46ce17c85 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -2346,9 +2346,8 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { ); expect(docBase.annotationControls.init).to.be.calledWith({ fileId: docBase.options.file.id, + onClick: docBase.handleAnnotationControlsClick, onEscape: docBase.handleAnnotationControlsEscape, - onHighlightClick: docBase.handleHighlightClick, - onRegionClick: docBase.handleRegionClick, showHighlightText: true, }); }); diff --git a/src/lib/viewers/image/ImageViewer.js b/src/lib/viewers/image/ImageViewer.js index be71c9ec3..6bdf68052 100644 --- a/src/lib/viewers/image/ImageViewer.js +++ b/src/lib/viewers/image/ImageViewer.js @@ -297,8 +297,8 @@ class ImageViewer extends ImageBaseViewer { this.annotationControls = new AnnotationControls(this.controls); this.annotationControls.init({ fileId: this.options.file.id, + onClick: this.handleAnnotationControlsClick, onEscape: this.handleAnnotationControlsEscape, - onRegionClick: this.handleRegionClick, }); } } diff --git a/src/lib/viewers/image/__tests__/ImageViewer-test.js b/src/lib/viewers/image/__tests__/ImageViewer-test.js index 9624e76a0..3adf9a6a2 100644 --- a/src/lib/viewers/image/__tests__/ImageViewer-test.js +++ b/src/lib/viewers/image/__tests__/ImageViewer-test.js @@ -372,8 +372,8 @@ describe('lib/viewers/image/ImageViewer', () => { expect(AnnotationControls.prototype.init).to.be.calledWith({ fileId: image.options.file.id, + onClick: image.handleAnnotationControlsClick, onEscape: image.handleAnnotationControlsEscape, - onRegionClick: image.handleRegionClick, }); }); });