Skip to content

Commit

Permalink
Chore: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan committed Jan 22, 2019
1 parent 9c7d22f commit df0b7de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/viewers/doc/__tests__/DocBaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2096,9 +2096,10 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {
beforeEach(() => {
sandbox.stub(docBase, 'resize');
sandbox.stub(docBase, 'emitMetric');
sandbox.stub(docBase, 'emit');
});

it('should do nothing if thumbnails sidebar does not exit', () => {
it('should do nothing if thumbnails sidebar does not exist', () => {
docBase.thumbnailsSidebarEl = undefined;

docBase.toggleThumbnails();
Expand All @@ -2117,6 +2118,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {
expect(thumbnailsSidebarEl.classList.contains(CLASS_HIDDEN)).to.be.false;
expect(docBase.resize).to.be.called;
expect(docBase.emitMetric).to.be.calledWith({ name: USER_DOCUMENT_THUMBNAIL_EVENTS.OPEN, data: 10 });
expect(docBase.emit).to.be.calledWith('thumbnailsOpen');
});

it('should toggle close and resize the viewer', () => {
Expand All @@ -2131,6 +2133,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {
expect(thumbnailsSidebarEl.classList.contains(CLASS_HIDDEN)).to.be.true;
expect(docBase.resize).to.be.called;
expect(docBase.emitMetric).to.be.calledWith({ name: USER_DOCUMENT_THUMBNAIL_EVENTS.CLOSE, data: 10 });
expect(docBase.emit).to.be.calledWith('thumbnailsClose');
});
});

Expand Down

0 comments on commit df0b7de

Please sign in to comment.