diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 18:12:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-25 18:12:32 +0300 |
commit | 7d8d5a3dab415672a41ab29c3bfa9581f275dc50 (patch) | |
tree | 7b9249d8ca8c12ad899b4e6d968193d58e63f458 /spec/frontend/blob | |
parent | 868c8c35fbddd439f4df76a5954e2a1caa2af3cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob')
3 files changed, 18 insertions, 20 deletions
diff --git a/spec/frontend/blob/components/blob_edit_header_spec.js b/spec/frontend/blob/components/blob_edit_header_spec.js index 910fc5c946d..b1ce0e9a4c5 100644 --- a/spec/frontend/blob/components/blob_edit_header_spec.js +++ b/spec/frontend/blob/components/blob_edit_header_spec.js @@ -1,5 +1,6 @@ import { GlFormInput, GlButton } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import BlobEditHeader from '~/blob/components/blob_edit_header.vue'; describe('Blob Header Editing', () => { @@ -40,7 +41,7 @@ describe('Blob Header Editing', () => { }); describe('functionality', () => { - it('emits input event when the blob name is changed', () => { + it('emits input event when the blob name is changed', async () => { const inputComponent = wrapper.find(GlFormInput); const newValue = 'bar.txt'; @@ -51,9 +52,8 @@ describe('Blob Header Editing', () => { }); inputComponent.vm.$emit('change'); - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.emitted().input[0]).toEqual([newValue]); - }); + await nextTick(); + expect(wrapper.emitted().input[0]).toEqual([newValue]); }); }); diff --git a/spec/frontend/blob/components/blob_header_spec.js b/spec/frontend/blob/components/blob_header_spec.js index bd81b1594bf..8e1b03c6126 100644 --- a/spec/frontend/blob/components/blob_header_spec.js +++ b/spec/frontend/blob/components/blob_header_spec.js @@ -1,4 +1,5 @@ import { shallowMount, mount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import BlobHeader from '~/blob/components/blob_header.vue'; import DefaultActions from '~/blob/components/blob_header_default_actions.vue'; import BlobFilepath from '~/blob/components/blob_header_filepath.vue'; @@ -139,26 +140,24 @@ describe('Blob Header Default Actions', () => { expect(wrapper.vm.viewer).toBe(null); }); - it('watches the changes in viewer data and emits event when the change is registered', () => { + it('watches the changes in viewer data and emits event when the change is registered', async () => { factory(); jest.spyOn(wrapper.vm, '$emit'); wrapper.vm.viewer = newViewer; - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.vm.$emit).toHaveBeenCalledWith('viewer-changed', newViewer); - }); + await nextTick(); + expect(wrapper.vm.$emit).toHaveBeenCalledWith('viewer-changed', newViewer); }); - it('does not emit event if the switcher is not rendered', () => { + it('does not emit event if the switcher is not rendered', async () => { factory(true); expect(wrapper.vm.showViewerSwitcher).toBe(false); jest.spyOn(wrapper.vm, '$emit'); wrapper.vm.viewer = newViewer; - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.vm.$emit).not.toHaveBeenCalled(); - }); + await nextTick(); + expect(wrapper.vm.$emit).not.toHaveBeenCalled(); }); }); }); diff --git a/spec/frontend/blob/components/blob_header_viewer_switcher_spec.js b/spec/frontend/blob/components/blob_header_viewer_switcher_spec.js index 9a560ec11f7..91baaf3ea69 100644 --- a/spec/frontend/blob/components/blob_header_viewer_switcher_spec.js +++ b/spec/frontend/blob/components/blob_header_viewer_switcher_spec.js @@ -1,5 +1,6 @@ import { GlButtonGroup, GlButton } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import BlobHeaderViewerSwitcher from '~/blob/components/blob_header_viewer_switcher.vue'; import { RICH_BLOB_VIEWER, @@ -72,26 +73,24 @@ describe('Blob Header Viewer Switcher', () => { expect(wrapper.vm.$emit).not.toHaveBeenCalled(); }); - it('emits an event when a Rich Viewer button is clicked', () => { + it('emits an event when a Rich Viewer button is clicked', async () => { factory(); expect(wrapper.vm.value).toBe(SIMPLE_BLOB_VIEWER); richBtn.vm.$emit('click'); - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', RICH_BLOB_VIEWER); - }); + await nextTick(); + expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', RICH_BLOB_VIEWER); }); - it('emits an event when a Simple Viewer button is clicked', () => { + it('emits an event when a Simple Viewer button is clicked', async () => { factory({ value: RICH_BLOB_VIEWER, }); simpleBtn.vm.$emit('click'); - return wrapper.vm.$nextTick().then(() => { - expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', SIMPLE_BLOB_VIEWER); - }); + await nextTick(); + expect(wrapper.vm.$emit).toHaveBeenCalledWith('input', SIMPLE_BLOB_VIEWER); }); }); }); |