Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Prevent filmstrip from sticking when controls hide #239

Merged
merged 2 commits into from Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/viewers/media/MediaControls.js
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
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