Commit ac070525 authored by Donald Cook's avatar Donald Cook

Small testing tweaks

parent 68cef200
...@@ -116,7 +116,8 @@ export default { ...@@ -116,7 +116,8 @@ export default {
<input <input
ref="service-desk-incoming-email" ref="service-desk-incoming-email"
type="text" type="text"
class="form-control incoming-email" class="form-control"
data-testid="incoming-email"
:placeholder="__('Incoming email')" :placeholder="__('Incoming email')"
:aria-label="__('Incoming email')" :aria-label="__('Incoming email')"
aria-describedby="incoming-email-describer" aria-describedby="incoming-email-describer"
......
...@@ -13,6 +13,7 @@ describe('ServiceDeskSetting', () => { ...@@ -13,6 +13,7 @@ describe('ServiceDeskSetting', () => {
}); });
const findTemplateDropdown = () => wrapper.find('#service-desk-template-select'); const findTemplateDropdown = () => wrapper.find('#service-desk-template-select');
const findIncomingEmail = () => wrapper.find('[data-testid="incoming-email"]');
describe('when isEnabled=true', () => { describe('when isEnabled=true', () => {
describe('only isEnabled', () => { describe('only isEnabled', () => {
...@@ -35,7 +36,7 @@ describe('ServiceDeskSetting', () => { ...@@ -35,7 +36,7 @@ describe('ServiceDeskSetting', () => {
it('should see loading spinner and not the incoming email', () => { it('should see loading spinner and not the incoming email', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); 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', () => { ...@@ -73,7 +74,7 @@ describe('ServiceDeskSetting', () => {
}); });
it('should see email and not the loading spinner', () => { 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); expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
}); });
...@@ -101,25 +102,25 @@ describe('ServiceDeskSetting', () => { ...@@ -101,25 +102,25 @@ describe('ServiceDeskSetting', () => {
}); });
it('should see custom email', () => { it('should see custom email', () => {
expect(wrapper.find('.incoming-email').element.value).toEqual(customEmail); expect(findIncomingEmail().element.value).toEqual(customEmail);
}); });
}); });
describe('customEmail is the same as incomingEmail', () => { describe('customEmail is the same as incomingEmail', () => {
const customEmail = 'foo@bar.com'; const email = 'foo@bar.com';
beforeEach(() => { beforeEach(() => {
wrapper = mount(ServiceDeskSetting, { wrapper = mount(ServiceDeskSetting, {
propsData: { propsData: {
isEnabled: true, isEnabled: true,
incomingEmail: customEmail, incomingEmail: email,
customEmail, customEmail: email,
}, },
}); });
}); });
it('should see custom email', () => { it('should see custom email', () => {
expect(wrapper.find('.incoming-email').element.value).toEqual(customEmail); expect(findIncomingEmail().element.value).toEqual(email);
}); });
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment