diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 15:08:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 15:08:18 +0300 |
commit | d00cd98a2b1b3f0899677f61257821c94cde8e31 (patch) | |
tree | 602dc6d5ca71906ff282d87808c0c1d04b853aeb /spec/frontend/vue_merge_request_widget | |
parent | edf0e5b64384499283b406f9087e890ac4fad13f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_merge_request_widget')
-rw-r--r-- | spec/frontend/vue_merge_request_widget/components/states/mr_widget_commit_message_dropdown_spec.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_commit_message_dropdown_spec.js b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_commit_message_dropdown_spec.js index e4febda1daa..b0f9f123950 100644 --- a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_commit_message_dropdown_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_commit_message_dropdown_spec.js @@ -1,22 +1,22 @@ -import { GlDropdownItem } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { GlDisclosureDropdown, GlDisclosureDropdownItem } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; + import CommitMessageDropdown from '~/vue_merge_request_widget/components/states/commit_message_dropdown.vue'; const commits = [ { title: 'Commit 1', - short_id: '78d5b7', + shortId: '78d5b7', message: 'Update test.txt', }, { title: 'Commit 2', - short_id: '34cbe28b', + shortId: '34cbe28b', message: 'Fixed test', }, { title: 'Commit 3', - short_id: 'fa42932a', + shortId: 'fa42932a', message: 'Added changelog', }, ]; @@ -25,10 +25,14 @@ describe('Commits message dropdown component', () => { let wrapper; const createComponent = () => { - wrapper = shallowMount(CommitMessageDropdown, { + wrapper = mount(CommitMessageDropdown, { propsData: { commits, }, + stubs: { + GlDisclosureDropdown, + GlDisclosureDropdownItem, + }, }); }; @@ -36,7 +40,7 @@ describe('Commits message dropdown component', () => { createComponent(); }); - const findDropdownElements = () => wrapper.findAllComponents(GlDropdownItem); + const findDropdownElements = () => wrapper.findAllComponents(GlDisclosureDropdownItem); const findFirstDropdownElement = () => findDropdownElements().at(0); it('should have 3 elements in dropdown list', () => { @@ -48,10 +52,9 @@ describe('Commits message dropdown component', () => { expect(findFirstDropdownElement().text()).toContain('Commit 1'); }); - it('should emit a commit title on selecting commit', async () => { - findFirstDropdownElement().vm.$emit('click'); + it('should emit a commit title on selecting commit', () => { + findFirstDropdownElement().find('button').trigger('click'); - await nextTick(); expect(wrapper.emitted().input[0]).toEqual(['Update test.txt']); }); }); |