diff options
Diffstat (limited to 'spec/frontend/clusters/forms/components/integration_form_spec.js')
-rw-r--r-- | spec/frontend/clusters/forms/components/integration_form_spec.js | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/spec/frontend/clusters/forms/components/integration_form_spec.js b/spec/frontend/clusters/forms/components/integration_form_spec.js index d041cd1e164..dd278bcd2ce 100644 --- a/spec/frontend/clusters/forms/components/integration_form_spec.js +++ b/spec/frontend/clusters/forms/components/integration_form_spec.js @@ -1,11 +1,11 @@ import { GlToggle, GlButton } 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 IntegrationForm from '~/clusters/forms/components/integration_form.vue'; import { createStore } from '~/clusters/forms/stores/index'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ClusterIntegrationForm', () => { let wrapper; @@ -19,7 +19,6 @@ describe('ClusterIntegrationForm', () => { const createWrapper = (storeValues = defaultStoreValues) => { wrapper = shallowMount(IntegrationForm, { - localVue, store: createStore(storeValues), provide: { autoDevopsHelpPath: 'topics/autodevops/index', @@ -76,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); }); }); }); |