Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
What: fix dom binding error Why: 1. bind videoElement twice 2. forget to bind wrapper and container How: retirive
- Loading branch information
1 parent
ea94a2a
commit 8b4893d
Showing
4 changed files
with
190 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
Oops, something went wrong.