diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js')
-rw-r--r-- | spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js index cb46751f66a..173a7fc4e11 100644 --- a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js +++ b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js @@ -13,6 +13,7 @@ describe('ServiceDeskSetting', () => { }); const findTemplateDropdown = () => wrapper.find('#service-desk-template-select'); + const findIncomingEmail = () => wrapper.find('[data-testid="incoming-email"]'); describe('when isEnabled=true', () => { describe('only isEnabled', () => { @@ -35,7 +36,7 @@ describe('ServiceDeskSetting', () => { it('should see loading spinner and not the incoming email', () => { expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); - expect(wrapper.find('.incoming-email').exists()).toBe(false); + expect(findIncomingEmail().exists()).toBe(false); }); }); }); @@ -73,7 +74,7 @@ describe('ServiceDeskSetting', () => { }); it('should see email and not the loading spinner', () => { - expect(wrapper.find('.incoming-email').element.value).toEqual(incomingEmail); + expect(findIncomingEmail().element.value).toEqual(incomingEmail); expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); }); @@ -85,6 +86,45 @@ describe('ServiceDeskSetting', () => { }); }); + describe('with customEmail', () => { + describe('customEmail is different than incomingEmail', () => { + const incomingEmail = 'foo@bar.com'; + const customEmail = 'custom@bar.com'; + + beforeEach(() => { + wrapper = mount(ServiceDeskSetting, { + propsData: { + isEnabled: true, + incomingEmail, + customEmail, + }, + }); + }); + + it('should see custom email', () => { + expect(findIncomingEmail().element.value).toEqual(customEmail); + }); + }); + + describe('customEmail is the same as incomingEmail', () => { + const email = 'foo@bar.com'; + + beforeEach(() => { + wrapper = mount(ServiceDeskSetting, { + propsData: { + isEnabled: true, + incomingEmail: email, + customEmail: email, + }, + }); + }); + + it('should see custom email', () => { + expect(findIncomingEmail().element.value).toEqual(email); + }); + }); + }); + describe('templates dropdown', () => { it('renders a dropdown to choose a template', () => { wrapper = shallowMount(ServiceDeskSetting, { |