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/clusters | |
parent | 868c8c35fbddd439f4df76a5954e2a1caa2af3cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/clusters')
3 files changed, 21 insertions, 29 deletions
diff --git a/spec/frontend/clusters/components/new_cluster_spec.js b/spec/frontend/clusters/components/new_cluster_spec.js index e4bca5eaaa5..b73442f6ec3 100644 --- a/spec/frontend/clusters/components/new_cluster_spec.js +++ b/spec/frontend/clusters/components/new_cluster_spec.js @@ -1,5 +1,6 @@ import { GlLink, GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import NewCluster from '~/clusters/components/new_cluster.vue'; import createClusterStore from '~/clusters/stores/new_cluster'; @@ -7,10 +8,10 @@ describe('NewCluster', () => { let store; let wrapper; - const createWrapper = () => { + const createWrapper = async () => { store = createClusterStore({ clusterConnectHelpPath: '/some/help/path' }); wrapper = shallowMount(NewCluster, { store, stubs: { GlLink, GlSprintf } }); - return wrapper.vm.$nextTick(); + await nextTick(); }; const findDescription = () => wrapper.find(GlSprintf); diff --git a/spec/frontend/clusters/components/remove_cluster_confirmation_spec.js b/spec/frontend/clusters/components/remove_cluster_confirmation_spec.js index 41bd492148e..173fefe6167 100644 --- a/spec/frontend/clusters/components/remove_cluster_confirmation_spec.js +++ b/spec/frontend/clusters/components/remove_cluster_confirmation_spec.js @@ -1,5 +1,6 @@ import { GlModal, GlSprintf } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import { stubComponent } from 'helpers/stub_component'; import RemoveClusterConfirmation from '~/clusters/components/remove_cluster_confirmation.vue'; import SplitButton from '~/vue_shared/components/split_button.vue'; @@ -43,7 +44,7 @@ describe('Remove cluster confirmation modal', () => { it('opens modal with "cleanup" option', async () => { findSplitButton().vm.$emit('remove-cluster-and-cleanup'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findModal().vm.show).toHaveBeenCalled(); expect(wrapper.vm.confirmCleanup).toEqual(true); @@ -55,7 +56,7 @@ describe('Remove cluster confirmation modal', () => { it('opens modal without "cleanup" option', async () => { findSplitButton().vm.$emit('remove-cluster'); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findModal().vm.show).toHaveBeenCalled(); expect(wrapper.vm.confirmCleanup).toEqual(false); diff --git a/spec/frontend/clusters/forms/components/integration_form_spec.js b/spec/frontend/clusters/forms/components/integration_form_spec.js index a9fb5c205fd..dd278bcd2ce 100644 --- a/spec/frontend/clusters/forms/components/integration_form_spec.js +++ b/spec/frontend/clusters/forms/components/integration_form_spec.js @@ -1,6 +1,6 @@ import { GlToggle, GlButton } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import IntegrationForm from '~/clusters/forms/components/integration_form.vue'; import { createStore } from '~/clusters/forms/stores/index'; @@ -75,32 +75,22 @@ describe('ClusterIntegrationForm', () => { describe('reactivity', () => { beforeEach(() => createWrapper()); - it('enables the submit button on changing toggle to different value', () => { - return wrapper.vm - .$nextTick() - .then(() => { - // setData is a bad approach because it changes the internal implementation which we should not touch - // but our GlFormInput lacks the ability to set a new value. - // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details - // eslint-disable-next-line no-restricted-syntax - wrapper.setData({ toggleEnabled: !defaultStoreValues.enabled }); - }) - .then(() => { - expect(findSubmitButton().props('disabled')).toBe(false); - }); + it('enables the submit button on changing toggle to different value', async () => { + await nextTick(); + // setData is a bad approach because it changes the internal implementation which we should not touch + // but our GlFormInput lacks the ability to set a new value. + // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details + // eslint-disable-next-line no-restricted-syntax + await wrapper.setData({ toggleEnabled: !defaultStoreValues.enabled }); + expect(findSubmitButton().props('disabled')).toBe(false); }); - it('enables the submit button on changing input values', () => { - return wrapper.vm - .$nextTick() - .then(() => { - // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details - // eslint-disable-next-line no-restricted-syntax - wrapper.setData({ envScope: `${defaultStoreValues.environmentScope}1` }); - }) - .then(() => { - expect(findSubmitButton().props('disabled')).toBe(false); - }); + it('enables the submit button on changing input values', async () => { + await nextTick(); + // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details + // eslint-disable-next-line no-restricted-syntax + await wrapper.setData({ envScope: `${defaultStoreValues.environmentScope}1` }); + expect(findSubmitButton().props('disabled')).toBe(false); }); }); }); |