@better-scroll/core
Version:
Minimalistic core scrolling for BetterScroll, it is pure and tiny
15 lines (13 loc) • 478 B
text/typescript
import { bubbling } from '../bubbling'
import { EventEmitter } from '@better-scroll/shared-utils'
describe('bubbling', () => {
it('bubbling', () => {
const parentHooks = new EventEmitter(['test'])
const childHooks = new EventEmitter(['test'])
bubbling(childHooks, parentHooks, ['test'])
const handler = jest.fn(() => {})
parentHooks.on('test', handler)
childHooks.trigger('test', 'dummy test')
expect(handler).toBeCalledWith('dummy test')
})
})