diff options
Diffstat (limited to 'spec/frontend/popovers/components')
-rw-r--r-- | spec/frontend/popovers/components/popovers_spec.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/frontend/popovers/components/popovers_spec.js b/spec/frontend/popovers/components/popovers_spec.js index 0c164d97564..25c509346d1 100644 --- a/spec/frontend/popovers/components/popovers_spec.js +++ b/spec/frontend/popovers/components/popovers_spec.js @@ -4,7 +4,7 @@ import { useMockMutationObserver } from 'helpers/mock_dom_observer'; import Popovers from '~/popovers/components/popovers.vue'; describe('popovers/components/popovers.vue', () => { - const { trigger: triggerMutate, observersCount } = useMockMutationObserver(); + const { trigger: triggerMutate } = useMockMutationObserver(); let wrapper; const buildWrapper = (...targets) => { @@ -120,10 +120,13 @@ describe('popovers/components/popovers.vue', () => { it('disconnects mutation observer on beforeDestroy', async () => { await buildWrapper(createPopoverTarget()); + const { observer } = wrapper.vm; + jest.spyOn(observer, 'disconnect'); - expect(observersCount()).toBe(1); + expect(observer.disconnect).toHaveBeenCalledTimes(0); wrapper.destroy(); - expect(observersCount()).toBe(0); + + expect(observer.disconnect).toHaveBeenCalledTimes(1); }); }); |