diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-23 03:08:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-23 03:08:21 +0300 |
commit | aaaa556ce9df9c3a8644f294f8ef6f0323b91e4e (patch) | |
tree | 8a8ceef49f6026754c87e56252778cb4e1c27e1e /spec/frontend/blob | |
parent | e53eae82b097308623e77a69f8cc3138cca3cf68 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r-- | spec/frontend/blob/components/blob_edit_header_spec.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/spec/frontend/blob/components/blob_edit_header_spec.js b/spec/frontend/blob/components/blob_edit_header_spec.js index 2b1bd1ac4ad..32a5624d032 100644 --- a/spec/frontend/blob/components/blob_edit_header_spec.js +++ b/spec/frontend/blob/components/blob_edit_header_spec.js @@ -1,6 +1,5 @@ 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', () => { @@ -15,8 +14,10 @@ describe('Blob Header Editing', () => { }, }); }; + const findDeleteButton = () => wrapper.findAllComponents(GlButton).wrappers.find((x) => x.text() === 'Delete file'); + const findFormInput = () => wrapper.findComponent(GlFormInput); beforeEach(() => { createComponent(); @@ -28,7 +29,7 @@ describe('Blob Header Editing', () => { }); it('contains a form input field', () => { - expect(wrapper.findComponent(GlFormInput).exists()).toBe(true); + expect(findFormInput().exists()).toBe(true); }); it('does not show delete button', () => { @@ -38,18 +39,15 @@ describe('Blob Header Editing', () => { describe('functionality', () => { it('emits input event when the blob name is changed', async () => { - const inputComponent = wrapper.findComponent(GlFormInput); + const inputComponent = findFormInput(); const newValue = 'bar.txt'; - // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details - // eslint-disable-next-line no-restricted-syntax - wrapper.setData({ - name: newValue, - }); + // update `name` with `newValue` + inputComponent.vm.$emit('input', newValue); + // trigger change event which emits input event on wrapper inputComponent.vm.$emit('change'); - await nextTick(); - expect(wrapper.emitted().input[0]).toEqual([newValue]); + expect(wrapper.emitted().input).toEqual([[newValue]]); }); }); |