From a7b3560714b4d9cc4ab32dffcd1f74a284b93580 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 18 Feb 2022 09:45:46 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-8-stable-ee --- .../add_context_commits_modal_spec.js.snap | 1 - .../components/add_context_commits_modal_spec.js | 50 ++++++++++------------ 2 files changed, 22 insertions(+), 29 deletions(-) (limited to 'spec/frontend/add_context_commits_modal/components') 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`] = ` { 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); }); }); -- cgit v1.2.3