import '@testing-library/jest-dom'; import $, {VeamsQueryObject} from '../src'; test('trigger() - trigger custom event (with additional data)', () => { document.body.innerHTML = `

text content 2

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $(document.getElementById('target-el')); const handler = jest.fn((evt) => { const evtData = { foo: true, str: 'test' }; expect(evt.type).toBe('customEvent'); expect(evt.detail).toMatchObject(evtData); }); $targetEls.on('customEvent', undefined, handler); $targetEls.trigger('customEvent', { detail: { foo: true, str: 'test' } }); expect(handler).toBeCalledTimes(1); });