Skip to content

Commit

Permalink
Chore: Cleanup eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum committed Aug 27, 2018
1 parent 57440cf commit 864bedc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
29 changes: 10 additions & 19 deletions src/__tests__/Annotator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,20 @@ describe('Annotator', () => {
it('should fetch and then render annotations', () => {
annotator.fetchPromise = Promise.resolve();
annotator.loadAnnotations();
return annotator.fetchPromise
.then(() => {
expect(annotator.render).toBeCalled();
expect(annotator.emit).not.toBeCalled();
})
.catch(() => {
sinon.assert.failException;
});
return annotator.fetchPromise.then(() => {
expect(annotator.render).toBeCalled();
expect(annotator.emit).not.toBeCalled();
});
});

it('should emit an error if the annotator fails to fetch and render annotations', () => {
annotator.fetchPromise = Promise.reject();
annotator.loadAnnotations();
return annotator.fetchPromise
.then(() => {
sinon.assert.failException;
expect(annotator.render).not.toBeCalled();
})
.catch((err) => {
expect(annotator.render).not.toBeCalled();
expect(annotator.emit).toBeCalledWith(ANNOTATOR_EVENT.loadError, err);
});
});
Expand Down Expand Up @@ -355,15 +350,11 @@ describe('Annotator', () => {
};

const result = annotator.fetchAnnotations();
result
.then(() => {
expect(result).toBeTruthy();
expect(annotator.threadMap).not.toBeUndefined();
expect(annotator.emit).toBeCalledWith(ANNOTATOR_EVENT.fetch);
})
.catch(() => {
sinon.assert.failException;
});
result.then(() => {
expect(result).toBeTruthy();
expect(annotator.threadMap).not.toBeUndefined();
expect(annotator.emit).toBeCalledWith(ANNOTATOR_EVENT.fetch);
});
});

it('should fetch existing annotations if the user can view all annotations', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/doc/CreateHighlightDialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CreateAnnotationDialog from '../CreateAnnotationDialog';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../icons/icons';
import { generateBtn, repositionCaret, getPageInfo, getDialogWidth, showElement } from '../util';
import { getDialogCoordsFromRange } from '../doc/docUtil';
import { getDialogCoordsFromRange } from './docUtil';
import {
CREATE_EVENT,
CLASS_ANNOTATION_CARET,
Expand Down
6 changes: 4 additions & 2 deletions src/doc/DocDrawingThread.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DrawingPath from '../drawing/DrawingPath';
import DrawingThread from '../drawing/DrawingThread';
import DocDrawingDialog from '../doc/DocDrawingDialog';
import DocDrawingDialog from './DocDrawingDialog';
import {
STATES,
DRAW_STATES,
Expand Down Expand Up @@ -41,7 +41,9 @@ class DocDrawingThread extends DrawingThread {
handleMove(location) {
if (this.drawingFlag !== DRAW_STATES.drawing || !location) {
return;
} else if (this.hasPageChanged(location)) {
}

if (this.hasPageChanged(location)) {
this.onPageChange(location);
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ export function repositionCaret(dialogEl, dialogX, highlightDialogWidth, browser
annotationCaretEl.style.left = `${caretLeftX}px`;

return 0;
} else if (dialogPastRight && !dialogPastLeft) {
}

if (dialogPastRight && !dialogPastLeft) {
// Leave a minimum of 10 pixels so caret doesn't go off edge
const caretRightX = Math.max(10, pageWidth - browserX);

Expand Down

0 comments on commit 864bedc

Please sign in to comment.