diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 21:08:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 21:08:35 +0000 |
commit | 24256212ea84e6fb6509f6fb317a2d2bac3d0d06 (patch) | |
tree | e4300d70d8e724179d9de657a68d88462aaaf04a /spec/frontend/create_cluster | |
parent | d933bc5a8738d24898c5a82cc72ee9bd050425e6 (diff) | |
download | gitlab-ce-24256212ea84e6fb6509f6fb317a2d2bac3d0d06.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/create_cluster')
-rw-r--r-- | spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js new file mode 100644 index 00000000000..9401ba83ef4 --- /dev/null +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js @@ -0,0 +1,53 @@ +import Vuex from 'vuex'; +import { shallowMount, createLocalVue } from '@vue/test-utils'; +import GkeSubmitButton from '~/create_cluster/gke_cluster/components/gke_submit_button.vue'; + +const localVue = createLocalVue(); + +localVue.use(Vuex); + +describe('GkeSubmitButton', () => { + let wrapper; + let store; + let hasValidData; + + const buildStore = () => + new Vuex.Store({ + getters: { + hasValidData, + }, + }); + + const buildWrapper = () => + shallowMount(GkeSubmitButton, { + store, + localVue, + }); + + const bootstrap = () => { + store = buildStore(); + wrapper = buildWrapper(); + }; + + beforeEach(() => { + hasValidData = jest.fn(); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('is disabled when hasValidData is false', () => { + hasValidData.mockReturnValueOnce(false); + bootstrap(); + + expect(wrapper.attributes('disabled')).toBe('disabled'); + }); + + it('is not disabled when hasValidData is true', () => { + hasValidData.mockReturnValueOnce(true); + bootstrap(); + + expect(wrapper.attributes('disabled')).toBeFalsy(); + }); +}); |