Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-24 00:08:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-24 00:08:35 +0300
commit24256212ea84e6fb6509f6fb317a2d2bac3d0d06 (patch)
treee4300d70d8e724179d9de657a68d88462aaaf04a /spec/frontend/create_cluster
parentd933bc5a8738d24898c5a82cc72ee9bd050425e6 (diff)
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.js53
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();
+ });
+});