refactor: adjust event options handling to be JSX friendly
This commit is contained in:
@@ -61,7 +61,7 @@ describe(`runtime-dom: events patching`, () => {
|
||||
const el = document.createElement('div')
|
||||
const event = new Event('click')
|
||||
const fn = jest.fn()
|
||||
patchProp(el, 'onClick.once.capture', null, fn)
|
||||
patchProp(el, 'onClickOnceCapture', null, fn)
|
||||
el.dispatchEvent(event)
|
||||
await timeout()
|
||||
el.dispatchEvent(event)
|
||||
@@ -73,13 +73,17 @@ describe(`runtime-dom: events patching`, () => {
|
||||
const el = document.createElement('div')
|
||||
const event = new Event('click')
|
||||
const fn = jest.fn()
|
||||
patchProp(el, 'onClick.capture', null, fn)
|
||||
patchProp(el, 'onClick.capture', fn, null)
|
||||
patchProp(el, 'onClickCapture', null, fn)
|
||||
el.dispatchEvent(event)
|
||||
await timeout()
|
||||
expect(fn).toHaveBeenCalledTimes(1)
|
||||
|
||||
patchProp(el, 'onClickCapture', fn, null)
|
||||
el.dispatchEvent(event)
|
||||
await timeout()
|
||||
el.dispatchEvent(event)
|
||||
await timeout()
|
||||
expect(fn).not.toHaveBeenCalled()
|
||||
expect(fn).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('should support native onclick', async () => {
|
||||
|
||||
Reference in New Issue
Block a user