diff options
Diffstat (limited to 'spec/frontend/popovers')
-rw-r--r-- | spec/frontend/popovers/components/popovers_spec.js | 15 | ||||
-rw-r--r-- | spec/frontend/popovers/index_spec.js | 17 |
2 files changed, 16 insertions, 16 deletions
diff --git a/spec/frontend/popovers/components/popovers_spec.js b/spec/frontend/popovers/components/popovers_spec.js index 2751a878e51..6fdcd34ae83 100644 --- a/spec/frontend/popovers/components/popovers_spec.js +++ b/spec/frontend/popovers/components/popovers_spec.js @@ -1,5 +1,6 @@ import { GlPopover } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import { useMockMutationObserver } from 'helpers/mock_dom_observer'; import Popovers from '~/popovers/components/popovers.vue'; @@ -7,10 +8,10 @@ describe('popovers/components/popovers.vue', () => { const { trigger: triggerMutate } = useMockMutationObserver(); let wrapper; - const buildWrapper = (...targets) => { + const buildWrapper = async (...targets) => { wrapper = shallowMount(Popovers); wrapper.vm.addPopovers(targets); - return wrapper.vm.$nextTick(); + await nextTick(); }; const createPopoverTarget = (options = {}) => { @@ -49,7 +50,7 @@ describe('popovers/components/popovers.vue', () => { buildWrapper(target); wrapper.vm.addPopovers([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.findAll(GlPopover)).toHaveLength(1); }); @@ -86,7 +87,7 @@ describe('popovers/components/popovers.vue', () => { await buildWrapper(createPopoverTarget(), createPopoverTarget()); wrapper.vm.dispose(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allPopovers()).toHaveLength(0); }); @@ -97,7 +98,7 @@ describe('popovers/components/popovers.vue', () => { await buildWrapper(target, createPopoverTarget()); wrapper.vm.dispose(target); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allPopovers()).toHaveLength(1); }); @@ -109,13 +110,13 @@ describe('popovers/components/popovers.vue', () => { await buildWrapper(target); wrapper.vm.addPopovers([target, createPopoverTarget()]); - await wrapper.vm.$nextTick(); + await nextTick(); triggerMutate(document.body, { entry: { removedNodes: [target] }, options: { childList: true }, }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allPopovers()).toHaveLength(1); }); diff --git a/spec/frontend/popovers/index_spec.js b/spec/frontend/popovers/index_spec.js index ea3b78332d7..c82fe7b47d9 100644 --- a/spec/frontend/popovers/index_spec.js +++ b/spec/frontend/popovers/index_spec.js @@ -1,8 +1,7 @@ +import { nextTick } from 'vue'; import { initPopovers, dispose, destroy } from '~/popovers'; describe('popovers/index.js', () => { - let popoversApp; - const createPopoverTarget = (trigger = 'hover') => { const target = document.createElement('button'); const dataset = { @@ -22,7 +21,7 @@ describe('popovers/index.js', () => { }; const buildPopoversApp = () => { - popoversApp = initPopovers('[data-toggle="popover"]'); + initPopovers('[data-toggle="popover"]'); }; const triggerEvent = (target, eventName = 'mouseenter') => { @@ -44,7 +43,7 @@ describe('popovers/index.js', () => { triggerEvent(target); - await popoversApp.$nextTick(); + await nextTick(); const html = document.querySelector('.gl-popover').innerHTML; expect(document.querySelector('.gl-popover')).not.toBe(null); @@ -59,7 +58,7 @@ describe('popovers/index.js', () => { buildPopoversApp(); triggerEvent(target, trigger); - await popoversApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-popover')).not.toBe(null); expect(document.querySelector('.gl-popover').innerHTML).toContain('default title'); @@ -73,7 +72,7 @@ describe('popovers/index.js', () => { const trigger = 'click'; const target = createPopoverTarget(trigger); triggerEvent(target, trigger); - await popoversApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-popover')).not.toBe(null); }); @@ -86,17 +85,17 @@ describe('popovers/index.js', () => { buildPopoversApp(); triggerEvent(target); triggerEvent(createPopoverTarget()); - await popoversApp.$nextTick(); + await nextTick(); expect(document.querySelectorAll('.gl-popover')).toHaveLength(2); dispose([fakeTarget]); - await popoversApp.$nextTick(); + await nextTick(); expect(document.querySelectorAll('.gl-popover')).toHaveLength(2); dispose([target]); - await popoversApp.$nextTick(); + await nextTick(); expect(document.querySelectorAll('.gl-popover')).toHaveLength(1); }); |