Skip to content

Commit

Permalink
Fix: Additional logic to reset highlight-comment threads (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinHoldstock authored Sep 13, 2017
1 parent 7bc9412 commit faef3df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/annotations/doc/DocHighlightThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class DocHighlightThread extends AnnotationThread {
this.type = TYPES.highlight;
} else if (!this.isMobile) {
this.destroy();
} else {
this.reset();
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/lib/annotations/doc/__tests__/DocHighlightThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ describe('lib/annotations/doc/DocHighlightThread', () => {
expect(highlightThread.destroy).to.be.called;
assert.equal(highlightThread.element, null);
});

it('should reset the thread if on mobile and a comment-highlight', () => {
sandbox.stub(highlightThread, 'reset');
highlightThread.annotations = [{}, {}, {}];
highlightThread.isMobile = true;

highlightThread.cancelFirstComment();

expect(highlightThread.reset).to.be.called;
});
});

describe('destroy()', () => {
Expand Down

0 comments on commit faef3df

Please sign in to comment.