Skip to content

Commit

Permalink
Chore: Remove unused thread.mouseoutHandler() (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum authored Aug 23, 2018
1 parent a847b01 commit 1017082
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
24 changes: 0 additions & 24 deletions src/AnnotationThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ class AnnotationThread extends EventEmitter {
// Explicitly bind listeners
this.showDialog = this.showDialog.bind(this);

if (!this.isMobile) {
this.mouseoutHandler = this.mouseoutHandler.bind(this);
}

this.setup();
}

Expand Down Expand Up @@ -549,26 +545,6 @@ class AnnotationThread extends EventEmitter {
return indicatorEl;
}

/**
* Mouseout handler. Hides dialog if we aren't creating the first one.
*
* @private
* @param {HTMLEvent} event - DOM event
* @return {void}
*/
mouseoutHandler(event) {
if (!event) {
return;
}

const mouseInDialog = util.isInDialog(event, event.toElement);

const firstAnnotation = util.getFirstAnnotation(this.annotations);
if (firstAnnotation && !mouseInDialog) {
this.hideDialog();
}
}

/**
* Saves the provided annotation to the thread and dialog if appropriate
* and resets state to inactive.
Expand Down
32 changes: 0 additions & 32 deletions src/__tests__/AnnotationThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,38 +681,6 @@ describe('AnnotationThread', () => {
});
});

// describe('mouseoutHandler()', () => {
// it('should do nothing if event does not exist', () => {
// util.isInDialog = jest.fn();
// thread.mouseoutHandler();
// expect(util.isInDialog).not.toBeCalled();
// });

// it('should not call hideDialog if there are no annotations in the thread', () => {
// thread.annotations = [];
// thread.hideDialog = jest.fn();
// thread.mouseoutHandler({});
// expect(thread.hideDialog).not.toBeCalled();
// });

// it('should call hideDialog if there are annotations in the thread', () => {
// thread.hideDialog = jest.fn();
// const annotation = new Annotation({
// fileVersionId: '2',
// threadID: '1',
// type: 'point',
// text: 'blah',
// threadNumber: '1',
// location: { x: 0, y: 0 },
// created: Date.now()
// });

// thread.annotations = [annotation];
// thread.mouseoutHandler({});
// expect(thread.hideDialog).toBeCalled();
// });
// });

describe('saveAnnotationToThread()', () => {
it('should add the annotation to the thread, and add to the dialog when the dialog exists', () => {
thread.annotations.push = jest.fn();
Expand Down

0 comments on commit 1017082

Please sign in to comment.