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/add_context_commits_modal/components | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/frontend/add_context_commits_modal/components')
2 files changed, 22 insertions, 29 deletions
diff --git a/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap b/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap index 10437c48f88..82114077455 100644 --- a/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap +++ b/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap @@ -17,7 +17,6 @@ exports[`AddContextCommitsModal renders modal with 2 tabs 1`] = ` <gl-tabs-stub contentclass="pt-0" queryparamname="tab" - theme="indigo" value="0" > <gl-tab-stub diff --git a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js index e7a20ae114c..9b93fd26fa0 100644 --- a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js +++ b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js @@ -1,5 +1,6 @@ import { GlModal, GlSearchBoxByType } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json'; import AddReviewItemsModal from '~/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue'; @@ -8,8 +9,7 @@ import * as actions from '~/add_context_commits_modal/store/actions'; import mutations from '~/add_context_commits_modal/store/mutations'; import defaultState from '~/add_context_commits_modal/store/state'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('AddContextCommitsModal', () => { let wrapper; @@ -36,7 +36,6 @@ describe('AddContextCommitsModal', () => { }); wrapper = shallowMount(AddReviewItemsModal, { - localVue, store, propsData: { contextCommitsPath: '', @@ -85,11 +84,10 @@ describe('AddContextCommitsModal', () => { expect(findModal().attributes('ok-disabled')).toBe('true'); }); - it('enabled ok button when atleast one row is selected', () => { + it('enabled ok button when atleast one row is selected', async () => { wrapper.vm.$store.state.selectedCommits = [{ ...commit, isSelected: true }]; - return wrapper.vm.$nextTick().then(() => { - expect(findModal().attributes('ok-disabled')).toBeFalsy(); - }); + await nextTick(); + expect(findModal().attributes('ok-disabled')).toBeFalsy(); }); }); @@ -101,11 +99,10 @@ describe('AddContextCommitsModal', () => { expect(findModal().attributes('ok-disabled')).toBe('true'); }); - it('an enabled ok button when atleast one row is selected', () => { + it('an enabled ok button when atleast one row is selected', async () => { wrapper.vm.$store.state.selectedCommits = [{ ...commit, isSelected: true }]; - return wrapper.vm.$nextTick().then(() => { - expect(findModal().attributes('ok-disabled')).toBeFalsy(); - }); + await nextTick(); + expect(findModal().attributes('ok-disabled')).toBeFalsy(); }); it('a disabled ok button in first tab, when row is selected in second tab', () => { @@ -115,33 +112,30 @@ describe('AddContextCommitsModal', () => { }); describe('has an ok button when clicked calls action', () => { - it('"createContextCommits" when only new commits to be added ', () => { + it('"createContextCommits" when only new commits to be added ', async () => { wrapper.vm.$store.state.selectedCommits = [{ ...commit, isSelected: true }]; findModal().vm.$emit('ok'); - return wrapper.vm.$nextTick().then(() => { - expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), { - commits: [{ ...commit, isSelected: true }], - forceReload: true, - }); + await nextTick(); + expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), { + commits: [{ ...commit, isSelected: true }], + forceReload: true, }); }); - it('"removeContextCommits" when only added commits are to be removed ', () => { + it('"removeContextCommits" when only added commits are to be removed ', async () => { wrapper.vm.$store.state.toRemoveCommits = [commit.short_id]; findModal().vm.$emit('ok'); - return wrapper.vm.$nextTick().then(() => { - expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), true); - }); + await nextTick(); + expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), true); }); - it('"createContextCommits" and "removeContextCommits" when new commits are to be added and old commits are to be removed', () => { + it('"createContextCommits" and "removeContextCommits" when new commits are to be added and old commits are to be removed', async () => { wrapper.vm.$store.state.selectedCommits = [{ ...commit, isSelected: true }]; wrapper.vm.$store.state.toRemoveCommits = [commit.short_id]; findModal().vm.$emit('ok'); - return wrapper.vm.$nextTick().then(() => { - expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), { - commits: [{ ...commit, isSelected: true }], - }); - expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), undefined); + await nextTick(); + expect(createContextCommits).toHaveBeenCalledWith(expect.anything(), { + commits: [{ ...commit, isSelected: true }], }); + expect(removeContextCommits).toHaveBeenCalledWith(expect.anything(), undefined); }); }); |