diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-02-19 14:03:41 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-02-19 14:05:09 +0000 |
commit | f0b27f9b406579a03e55fa16cbc7095009dc8c2b (patch) | |
tree | f4ca8bd423a68241f4ca2a80249947df5d3c6063 /spec/javascripts/clusters/components | |
parent | 9fc393c23dfa206802fdce162be1e06dca65ab54 (diff) | |
download | gitlab-ce-f0b27f9b406579a03e55fa16cbc7095009dc8c2b.tar.gz |
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
Diffstat (limited to 'spec/javascripts/clusters/components')
-rw-r--r-- | spec/javascripts/clusters/components/applications_spec.js | 70 |
1 files changed, 70 insertions, 0 deletions
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); + }); + }); + }); }); |