diff --git a/src/modules/esl-toggleable/test/toggleable.integration.test.ts b/src/modules/esl-toggleable/test/toggleable.integration.test.ts index 49b828b6a..cb22cadb5 100644 --- a/src/modules/esl-toggleable/test/toggleable.integration.test.ts +++ b/src/modules/esl-toggleable/test/toggleable.integration.test.ts @@ -4,16 +4,16 @@ import {ESLTrigger} from '../../esl-trigger/core'; describe('ESLToggleable custom element - integration with ESLTrigger', () => { const $trigger = ESLTrigger.create(); const $toggleable = ESLToggleable.create(); - $trigger.dispatchEvent = jest.fn(); $trigger.$target = $toggleable; + jest.spyOn($trigger, 'dispatchEvent'); + beforeAll(() => { - document.body.appendChild($trigger); jest.useFakeTimers(); ESLToggleable.register(); ESLTrigger.register(); - document.body.append($trigger); + document.body.appendChild($trigger); document.body.appendChild($toggleable); });