diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 12:45:46 +0300 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/frontend/tooltips | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/frontend/tooltips')
-rw-r--r-- | spec/frontend/tooltips/components/tooltips_spec.js | 35 | ||||
-rw-r--r-- | spec/frontend/tooltips/index_spec.js | 15 |
2 files changed, 26 insertions, 24 deletions
diff --git a/spec/frontend/tooltips/components/tooltips_spec.js b/spec/frontend/tooltips/components/tooltips_spec.js index 9b703b74a1a..eef352a72ff 100644 --- a/spec/frontend/tooltips/components/tooltips_spec.js +++ b/spec/frontend/tooltips/components/tooltips_spec.js @@ -1,5 +1,6 @@ import { GlTooltip } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import { useMockMutationObserver } from 'helpers/mock_dom_observer'; import Tooltips from '~/tooltips/components/tooltips.vue'; @@ -46,7 +47,7 @@ describe('tooltips/components/tooltips.vue', () => { it('attaches tooltips to the targets specified', async () => { wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).props('target')).toBe(target); }); @@ -56,7 +57,7 @@ describe('tooltips/components/tooltips.vue', () => { wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).exists()).toBe(false); }); @@ -65,7 +66,7 @@ describe('tooltips/components/tooltips.vue', () => { wrapper.vm.addTooltips([target]); wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.findAll(GlTooltip)).toHaveLength(1); }); @@ -73,7 +74,7 @@ describe('tooltips/components/tooltips.vue', () => { it('sets tooltip content from title attribute', async () => { wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).text()).toBe(target.getAttribute('title')); }); @@ -85,7 +86,7 @@ describe('tooltips/components/tooltips.vue', () => { }); wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).html()).toContain(target.getAttribute('title')); }); @@ -94,7 +95,7 @@ describe('tooltips/components/tooltips.vue', () => { const config = { show: true }; target = createTooltipTarget(); wrapper.vm.addTooltips([target], config); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).props()).toMatchObject(config); }); @@ -110,7 +111,7 @@ describe('tooltips/components/tooltips.vue', () => { target = createTooltipTarget({ [attribute]: value }); wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).props(prop)).toBe(value); }, @@ -124,10 +125,10 @@ describe('tooltips/components/tooltips.vue', () => { it('removes all tooltips when elements is nil', async () => { wrapper.vm.addTooltips([createTooltipTarget(), createTooltipTarget()]); - await wrapper.vm.$nextTick(); + await nextTick(); wrapper.vm.dispose(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allTooltips()).toHaveLength(0); }); @@ -136,10 +137,10 @@ describe('tooltips/components/tooltips.vue', () => { const target = createTooltipTarget(); wrapper.vm.addTooltips([target, createTooltipTarget()]); - await wrapper.vm.$nextTick(); + await nextTick(); wrapper.vm.dispose(target); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allTooltips()).toHaveLength(1); }); @@ -154,13 +155,13 @@ describe('tooltips/components/tooltips.vue', () => { const target = createTooltipTarget(); wrapper.vm.addTooltips([target, createTooltipTarget()]); - await wrapper.vm.$nextTick(); + await nextTick(); triggerMutate(document.body, { entry: { removedNodes: [target] }, options: { childList: true }, }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(allTooltips()).toHaveLength(1); }); @@ -175,7 +176,7 @@ describe('tooltips/components/tooltips.vue', () => { wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); wrapper.vm.triggerEvent(target, event); @@ -195,14 +196,14 @@ describe('tooltips/components/tooltips.vue', () => { wrapper.vm.addTooltips([target]); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).text()).toBe(currentTitle); target.setAttribute('title', newTitle); wrapper.vm.fixTitle(target); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find(GlTooltip).text()).toBe(newTitle); }); @@ -225,7 +226,7 @@ describe('tooltips/components/tooltips.vue', () => { buildWrapper(); wrapper.vm.addTooltips([createTooltipTarget()]); - await wrapper.vm.$nextTick(); + await nextTick(); wrapper.findComponent(GlTooltip).vm.$emit('hidden'); expect(wrapper.emitted('hidden')).toHaveLength(1); diff --git a/spec/frontend/tooltips/index_spec.js b/spec/frontend/tooltips/index_spec.js index 9c03ca8f4c9..198a0315ef7 100644 --- a/spec/frontend/tooltips/index_spec.js +++ b/spec/frontend/tooltips/index_spec.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { add, initTooltips, @@ -57,7 +58,7 @@ describe('tooltips/index.js', () => { triggerEvent(target); - await tooltipsApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-tooltip')).not.toBe(null); expect(document.querySelector('.gl-tooltip').innerHTML).toContain('default title'); @@ -69,7 +70,7 @@ describe('tooltips/index.js', () => { buildTooltipsApp(); triggerEvent(target, 'click'); - await tooltipsApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-tooltip')).not.toBe(null); expect(document.querySelector('.gl-tooltip').innerHTML).toContain('default title'); @@ -83,7 +84,7 @@ describe('tooltips/index.js', () => { buildTooltipsApp(); add([target], { title: 'custom title' }); - await tooltipsApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-tooltip')).not.toBe(null); expect(document.querySelector('.gl-tooltip').innerHTML).toContain('custom title'); @@ -97,13 +98,13 @@ describe('tooltips/index.js', () => { buildTooltipsApp(); triggerEvent(target); - await tooltipsApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-tooltip')).not.toBe(null); dispose([target]); - await tooltipsApp.$nextTick(); + await nextTick(); expect(document.querySelector('.gl-tooltip')).toBe(null); }); @@ -122,7 +123,7 @@ describe('tooltips/index.js', () => { buildTooltipsApp(); - await tooltipsApp.$nextTick(); + await nextTick(); jest.spyOn(tooltipsApp, 'triggerEvent'); @@ -137,7 +138,7 @@ describe('tooltips/index.js', () => { buildTooltipsApp(); - await tooltipsApp.$nextTick(); + await nextTick(); jest.spyOn(tooltipsApp, 'fixTitle'); |