From f0b27f9b406579a03e55fa16cbc7095009dc8c2b Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Mon, 19 Feb 2018 14:03:41 +0000 Subject: Adds support to render the IP address in the application ingress row Updates components to use a slot to allow to reuse the clipboard button Adds tests --- .../clusters/components/applications_spec.js | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index 1a8affad4e3..d055679aea8 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -44,4 +44,74 @@ describe('Applications', () => { }); /* */ }); + + describe('Ingress application', () => { + describe('when installed', () => { + describe('with ip address', () => { + it('renders ip address with a clipboard button', () => { + vm = mountComponent(Applications, { + applications: { + ingress: { + title: 'Ingress', + status: 'installed', + external_ip: '0.0.0.0', + }, + helm: { title: 'Helm Tiller' }, + runner: { title: 'GitLab Runner' }, + prometheus: { title: 'Prometheus' }, + }, + }); + + expect( + vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), + ).toEqual('0.0.0.0'); + expect( + vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text'), + ).toEqual('0.0.0.0'); + }); + }); + + describe('without ip address', () => { + it('renders an input text with a question mark and an alert text', () => { + vm = mountComponent(Applications, { + applications: { + ingress: { + title: 'Ingress', + status: 'installed', + }, + helm: { title: 'Helm Tiller' }, + runner: { title: 'GitLab Runner' }, + prometheus: { title: 'Prometheus' }, + }, + }); + + expect( + vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), + ).toEqual('?'); + + expect( + vm.$el.querySelector('.js-no-ip-message').textContent.replace(/\n(\s)+/g, ' ').trim(), + ).toEqual( + 'The IP address is in process to be assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information', + ); + }); + }); + }); + + describe('before installing', () => { + it('does not render the IP address', () => { + vm = mountComponent(Applications, { + applications: { + helm: { title: 'Helm Tiller' }, + ingress: { title: 'Ingress' }, + runner: { title: 'GitLab Runner' }, + prometheus: { title: 'Prometheus' }, + }, + }); + + expect(vm.$el.textContent).not.toContain('Ingress IP Address'); + expect(vm.$el.querySelector('#ipAddress')).toBe(null); + }); + }); + }); }); -- cgit v1.2.1 From 3619c9174558bd2b2ae625ac6db480c437eb8484 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 20 Feb 2018 12:44:20 +0000 Subject: Adds missing links, uses value instead of placeholder in input field and properly sets the ip key --- spec/javascripts/clusters/components/applications_spec.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index d055679aea8..9bd47aea7f9 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -54,14 +54,13 @@ describe('Applications', () => { ingress: { title: 'Ingress', status: 'installed', - external_ip: '0.0.0.0', + externalIp: '0.0.0.0', }, helm: { title: 'Helm Tiller' }, runner: { title: 'GitLab Runner' }, prometheus: { title: 'Prometheus' }, }, }); - expect( vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), ).toEqual('0.0.0.0'); @@ -92,7 +91,7 @@ describe('Applications', () => { expect( vm.$el.querySelector('.js-no-ip-message').textContent.replace(/\n(\s)+/g, ' ').trim(), ).toEqual( - 'The IP address is in process to be assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information', + 'The IP address is still in the process of being assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information', ); }); }); -- cgit v1.2.1 From e1d587f5d6fe76900dd7cce26178464d4455fb8b Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 20 Feb 2018 16:50:14 +0000 Subject: Remove duplicate ID --- spec/javascripts/clusters/components/applications_spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index 9bd47aea7f9..e3312f62c04 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -62,7 +62,7 @@ describe('Applications', () => { }, }); expect( - vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), + vm.$el.querySelector('.js-ip-address').getAttribute('placeholder'), ).toEqual('0.0.0.0'); expect( vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text'), @@ -85,7 +85,7 @@ describe('Applications', () => { }); expect( - vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), + vm.$el.querySelector('.js-ip-address').getAttribute('placeholder'), ).toEqual('?'); expect( @@ -109,7 +109,7 @@ describe('Applications', () => { }); expect(vm.$el.textContent).not.toContain('Ingress IP Address'); - expect(vm.$el.querySelector('#ipAddress')).toBe(null); + expect(vm.$el.querySelector('.js-ip-address')).toBe(null); }); }); }); -- cgit v1.2.1 From 218e7223de930ff754a4df782ee9c5b5e000af36 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 21 Feb 2018 13:44:07 +0000 Subject: Changes after review --- spec/javascripts/clusters/components/applications_spec.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index e3312f62c04..6e09c829213 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -88,11 +88,7 @@ describe('Applications', () => { vm.$el.querySelector('.js-ip-address').getAttribute('placeholder'), ).toEqual('?'); - expect( - vm.$el.querySelector('.js-no-ip-message').textContent.replace(/\n(\s)+/g, ' ').trim(), - ).toEqual( - 'The IP address is still in the process of being assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information', - ); + expect(vm.$el.querySelector('.js-no-ip-message')).not.toBe(null); }); }); }); -- cgit v1.2.1 From 18b1b5be65e6421b080216e61e27c41be913f802 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 22 Feb 2018 16:38:12 +0000 Subject: Use value attribute in ip input Removes double quoted string --- spec/javascripts/clusters/components/applications_spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index 6e09c829213..51c2a7e76c5 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -61,9 +61,11 @@ describe('Applications', () => { prometheus: { title: 'Prometheus' }, }, }); + expect( - vm.$el.querySelector('.js-ip-address').getAttribute('placeholder'), + vm.$el.querySelector('.js-ip-address').value, ).toEqual('0.0.0.0'); + expect( vm.$el.querySelector('.js-clipboard-btn').getAttribute('data-clipboard-text'), ).toEqual('0.0.0.0'); @@ -85,7 +87,7 @@ describe('Applications', () => { }); expect( - vm.$el.querySelector('.js-ip-address').getAttribute('placeholder'), + vm.$el.querySelector('.js-ip-address').value, ).toEqual('?'); expect(vm.$el.querySelector('.js-no-ip-message')).not.toBe(null); -- cgit v1.2.1 From d434c62a83f5fe02f6eff3b9e311cba2eab38bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 26 Feb 2018 19:43:34 +0000 Subject: Move EE-specific JavaScript files to ee/app/assets/javascripts --- spec/javascripts/clusters/components/applications_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/javascripts/clusters/components/applications_spec.js') diff --git a/spec/javascripts/clusters/components/applications_spec.js b/spec/javascripts/clusters/components/applications_spec.js index 1a8affad4e3..15832c38f25 100644 --- a/spec/javascripts/clusters/components/applications_spec.js +++ b/spec/javascripts/clusters/components/applications_spec.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import applications from '~/clusters/components/applications.vue'; -import mountComponent from '../../helpers/vue_mount_component_helper'; +import mountComponent from 'spec/helpers/vue_mount_component_helper'; describe('Applications', () => { let vm; -- cgit v1.2.1