Skip to content

Commit

Permalink
Fix: Hide filmstrip when controls hide (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press authored Jul 27, 2017
1 parent 01cdf3c commit 0ba7804
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/viewers/media/MediaControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ class MediaControls extends EventEmitter {

if (this.wrapperEl && this.wrapperEl.parentNode) {
this.wrapperEl.parentNode.classList.remove(SHOW_CONTROLS_CLASS);
this.filmstripHideHandler();
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/lib/viewers/media/__tests__/MediaControls-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ describe('lib/viewers/media/MediaControls', () => {
describe('hide()', () => {
beforeEach(() => {
stubs.isSettingsVisible = sandbox.stub(mediaControls, 'isSettingsVisible');
stubs.filmstripHideHandler = sandbox.stub(mediaControls, 'filmstripHideHandler');
stubs.show = sandbox.stub(mediaControls, 'show');
});

Expand All @@ -643,13 +644,14 @@ describe('lib/viewers/media/MediaControls', () => {
expect(stubs.show).to.be.called;
});

it('should remove the show controls class if the wrapper element and parent exist', () => {
it('should remove the show controls class and hide the filmstrip if the wrapper element and parent exist', () => {
mediaControls.preventHiding = false;
stubs.isSettingsVisible.returns(false);

mediaControls.hide();
expect(stubs.show).to.not.be.called;
expect(mediaControls.wrapperEl.parentNode.classList.contains('bp-media-controls-is-visible')).to.be.false;
expect(stubs.filmstripHideHandler).to.be.called;
});
});

Expand Down

0 comments on commit 0ba7804

Please sign in to comment.