Skip to content

Commit

Permalink
[bugfix] fix dom binding error
Browse files Browse the repository at this point in the history
What: fix dom binding error
Why:
1. bind videoElement twice
2. forget to bind wrapper and container
How: retirive
  • Loading branch information
toxic-johann committed Jul 31, 2017
1 parent ea94a2a commit 8b4893d
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 3 deletions.
26 changes: 26 additions & 0 deletions __tests__/bugfix.js
@@ -0,0 +1,26 @@
import Chimee from 'index';
test('redudant event bind on video', () => {
const wrapper = document.createElement('div');
const fn = jest.fn();
const cfn = jest.fn();
const wfn = jest.fn();
const plugin = {
name: 'redudantEventBind',
events: {
click: fn,
c_click: cfn,
w_click: wfn
}
};
Chimee.install(plugin);
const player = new Chimee({
wrapper,
plugin: ['redudantEventBind']
});
player.__dispatcher.dom.videoElement.dispatchEvent(new Event('click'));
expect(fn).toHaveBeenCalledTimes(1);
player.__dispatcher.dom.container.dispatchEvent(new Event('click'));
expect(cfn).toHaveBeenCalledTimes(1);
player.__dispatcher.dom.wrapper.dispatchEvent(new Event('click'));
expect(wfn).toHaveBeenCalledTimes(1);
});

0 comments on commit 8b4893d

Please sign in to comment.