diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-05-08 22:52:23 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-05-08 22:52:23 +0000 |
commit | fa6e00d05dedfac9ec28bf1a4735bffc38a5b4d0 (patch) | |
tree | 07c2087939b6c6dce33620c57a6989d76547e681 /spec/frontend/operation_settings/components/external_dashboard_spec.js | |
parent | 204dca4436f5b2c82611a873d05186ec4ff4c17c (diff) | |
parent | 2f003b58645b3cbc987c240f844b1ff6eb0c026a (diff) | |
download | gitlab-ce-fa6e00d05dedfac9ec28bf1a4735bffc38a5b4d0.tar.gz |
Merge branch '11-11-stable-prepare-rc2' into '11-11-stable'
Prepare 11.11.0-rc2 release
See merge request gitlab-org/gitlab-ce!28215
Diffstat (limited to 'spec/frontend/operation_settings/components/external_dashboard_spec.js')
-rw-r--r-- | spec/frontend/operation_settings/components/external_dashboard_spec.js | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/spec/frontend/operation_settings/components/external_dashboard_spec.js b/spec/frontend/operation_settings/components/external_dashboard_spec.js new file mode 100644 index 00000000000..de1dd219fe0 --- /dev/null +++ b/spec/frontend/operation_settings/components/external_dashboard_spec.js @@ -0,0 +1,100 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlButton, GlLink, GlFormGroup, GlFormInput } from '@gitlab/ui'; +import ExternalDashboard from '~/operation_settings/components/external_dashboard.vue'; +import { TEST_HOST } from 'helpers/test_constants'; + +describe('operation settings external dashboard component', () => { + let wrapper; + const externalDashboardPath = `http://mock-external-domain.com/external/dashboard/path`; + const externalDashboardHelpPagePath = `${TEST_HOST}/help/page/path`; + + beforeEach(() => { + wrapper = shallowMount(ExternalDashboard, { + propsData: { + externalDashboardPath, + externalDashboardHelpPagePath, + }, + }); + }); + + it('renders header text', () => { + expect(wrapper.find('.js-section-header').text()).toBe('External Dashboard'); + }); + + describe('sub-header', () => { + let subHeader; + + beforeEach(() => { + subHeader = wrapper.find('.js-section-sub-header'); + }); + + it('renders descriptive text', () => { + expect(subHeader.text()).toContain( + 'Add a button to the metrics dashboard linking directly to your existing external dashboards.', + ); + }); + + it('renders help page link', () => { + const link = subHeader.find(GlLink); + + expect(link.text()).toBe('Learn more'); + expect(link.attributes().href).toBe(externalDashboardHelpPagePath); + }); + }); + + describe('form', () => { + let form; + + beforeEach(() => { + form = wrapper.find('form'); + }); + + describe('external dashboard url', () => { + describe('input label', () => { + let formGroup; + + beforeEach(() => { + formGroup = form.find(GlFormGroup); + }); + + it('uses label text', () => { + expect(formGroup.attributes().label).toBe('Full dashboard URL'); + }); + + it('uses description text', () => { + expect(formGroup.attributes().description).toBe( + 'Enter the URL of the dashboard you want to link to', + ); + }); + }); + + describe('input field', () => { + let input; + + beforeEach(() => { + input = form.find(GlFormInput); + }); + + it('defaults to externalDashboardPath prop', () => { + expect(input.attributes().value).toBe(externalDashboardPath); + }); + + it('uses a placeholder', () => { + expect(input.attributes().placeholder).toBe('https://my-org.gitlab.io/my-dashboards'); + }); + }); + + describe('submit button', () => { + let submit; + + beforeEach(() => { + submit = form.find(GlButton); + }); + + it('renders button label', () => { + expect(submit.text()).toBe('Save Changes'); + }); + }); + }); + }); +}); |