diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/frontend/integrations | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/frontend/integrations')
4 files changed, 119 insertions, 144 deletions
diff --git a/spec/frontend/integrations/edit/components/dynamic_field_spec.js b/spec/frontend/integrations/edit/components/dynamic_field_spec.js index 53234419f5f..ecd03103992 100644 --- a/spec/frontend/integrations/edit/components/dynamic_field_spec.js +++ b/spec/frontend/integrations/edit/components/dynamic_field_spec.js @@ -37,153 +37,142 @@ describe('DynamicField', () => { const findGlFormTextarea = () => wrapper.find(GlFormTextarea); describe('template', () => { - describe.each([[true, 'disabled', 'readonly'], [false, undefined, undefined]])( - 'dynamic field, when isInheriting = `%p`', - (isInheriting, disabled, readonly) => { - describe('type is checkbox', () => { - beforeEach(() => { - createComponent( - { - type: 'checkbox', - }, - isInheriting, - ); - }); - - it(`renders GlFormCheckbox, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { - expect(findGlFormCheckbox().exists()).toBe(true); - expect( - findGlFormCheckbox() - .find('[type=checkbox]') - .attributes('disabled'), - ).toBe(disabled); - }); + describe.each([ + [true, 'disabled', 'readonly'], + [false, undefined, undefined], + ])('dynamic field, when isInheriting = `%p`', (isInheriting, disabled, readonly) => { + describe('type is checkbox', () => { + beforeEach(() => { + createComponent( + { + type: 'checkbox', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormCheckbox, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { + expect(findGlFormCheckbox().exists()).toBe(true); + expect(findGlFormCheckbox().find('[type=checkbox]').attributes('disabled')).toBe( + disabled, + ); }); - describe('type is select', () => { - beforeEach(() => { - createComponent( - { - type: 'select', - choices: [['all', 'All details'], ['standard', 'Standard']], - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormSelect, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { - expect(findGlFormSelect().exists()).toBe(true); - expect(findGlFormSelect().findAll('option')).toHaveLength(2); - expect( - findGlFormSelect() - .find('select') - .attributes('disabled'), - ).toBe(disabled); - }); + describe('type is select', () => { + beforeEach(() => { + createComponent( + { + type: 'select', + choices: [ + ['all', 'All details'], + ['standard', 'Standard'], + ], + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormSelect, which ${isInheriting ? 'is' : 'is not'} disabled`, () => { + expect(findGlFormSelect().exists()).toBe(true); + expect(findGlFormSelect().findAll('option')).toHaveLength(2); + expect(findGlFormSelect().find('select').attributes('disabled')).toBe(disabled); }); - describe('type is textarea', () => { - beforeEach(() => { - createComponent( - { - type: 'textarea', - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormTextarea, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormTextarea().exists()).toBe(true); - expect( - findGlFormTextarea() - .find('textarea') - .attributes('readonly'), - ).toBe(readonly); - }); + describe('type is textarea', () => { + beforeEach(() => { + createComponent( + { + type: 'textarea', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormInput().exists()).toBe(false); - }); + it(`renders GlFormTextarea, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormTextarea().exists()).toBe(true); + expect(findGlFormTextarea().find('textarea').attributes('readonly')).toBe(readonly); }); - describe('type is password', () => { - beforeEach(() => { - createComponent( - { - type: 'password', - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormInput().exists()).toBe(false); + }); + }); - it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormInput().exists()).toBe(true); - expect(findGlFormInput().attributes('type')).toBe('password'); - expect(findGlFormInput().attributes('readonly')).toBe(readonly); - }); + describe('type is password', () => { + beforeEach(() => { + createComponent( + { + type: 'password', + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); - }); + it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormInput().exists()).toBe(true); + expect(findGlFormInput().attributes('type')).toBe('password'); + expect(findGlFormInput().attributes('readonly')).toBe(readonly); }); - describe('type is text', () => { - beforeEach(() => { - createComponent( - { - type: 'text', - required: true, - }, - isInheriting, - ); - }); + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + }); + }); - it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { - expect(findGlFormInput().exists()).toBe(true); - expect(findGlFormInput().attributes()).toMatchObject({ + describe('type is text', () => { + beforeEach(() => { + createComponent( + { type: 'text', - id: 'service_project_url', - name: 'service[project_url]', - placeholder: defaultProps.placeholder, - required: 'required', - }); - expect(findGlFormInput().attributes('readonly')).toBe(readonly); - }); + required: true, + }, + isInheriting, + ); + }); - it('does not render other types of input', () => { - expect(findGlFormCheckbox().exists()).toBe(false); - expect(findGlFormSelect().exists()).toBe(false); - expect(findGlFormTextarea().exists()).toBe(false); + it(`renders GlFormInput, which ${isInheriting ? 'is' : 'is not'} readonly`, () => { + expect(findGlFormInput().exists()).toBe(true); + expect(findGlFormInput().attributes()).toMatchObject({ + type: 'text', + id: 'service_project_url', + name: 'service[project_url]', + placeholder: defaultProps.placeholder, + required: 'required', }); + expect(findGlFormInput().attributes('readonly')).toBe(readonly); }); - }, - ); + + it('does not render other types of input', () => { + expect(findGlFormCheckbox().exists()).toBe(false); + expect(findGlFormSelect().exists()).toBe(false); + expect(findGlFormTextarea().exists()).toBe(false); + }); + }); + }); describe('help text', () => { it('renders description with help text', () => { createComponent(); - expect( - findGlFormGroup() - .find('small') - .text(), - ).toBe(defaultProps.help); + expect(findGlFormGroup().find('small').text()).toBe(defaultProps.help); }); it('renders description with help text as HTML', () => { @@ -193,11 +182,7 @@ describe('DynamicField', () => { help: helpHTML, }); - expect( - findGlFormGroup() - .find('small') - .html(), - ).toContain(helpHTML); + expect(findGlFormGroup().find('small').html()).toContain(helpHTML); }); }); @@ -205,11 +190,7 @@ describe('DynamicField', () => { it('renders label with title', () => { createComponent(); - expect( - findGlFormGroup() - .find('label') - .text(), - ).toBe(defaultProps.title); + expect(findGlFormGroup().find('label').text()).toBe(defaultProps.title); }); describe('for password field with some value (hidden by backend)', () => { @@ -219,11 +200,7 @@ describe('DynamicField', () => { value: 'true', }); - expect( - findGlFormGroup() - .find('label') - .text(), - ).toBe(`Enter new ${defaultProps.title}`); + expect(findGlFormGroup().find('label').text()).toBe(`Enter new ${defaultProps.title}`); }); }); }); diff --git a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js index a727bb9c734..eaeed2703d1 100644 --- a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js @@ -12,7 +12,7 @@ describe('JiraIssuesFields', () => { editProjectPath: '/edit', }; - const createComponent = props => { + const createComponent = (props) => { wrapper = mount(JiraIssuesFields, { propsData: { ...defaultProps, ...props }, }); diff --git a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js index 782930eb6a2..a69e8d6e163 100644 --- a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js @@ -57,9 +57,7 @@ describe('JiraTriggerFields', () => { // browsers don't include unchecked boxes in form submissions. it('includes comment settings as false even if unchecked', () => { expect( - findCommentSettings() - .find('input[name="service[comment_on_event_enabled]"]') - .exists(), + findCommentSettings().find('input[name="service[comment_on_event_enabled]"]').exists(), ).toBe(true); }); @@ -106,11 +104,11 @@ describe('JiraTriggerFields', () => { true, ); - wrapper.findAll('[type=checkbox]').wrappers.forEach(checkbox => { + wrapper.findAll('[type=checkbox]').wrappers.forEach((checkbox) => { expect(checkbox.attributes('disabled')).toBe('disabled'); }); - wrapper.findAll('[type=radio]').wrappers.forEach(radio => { + wrapper.findAll('[type=radio]').wrappers.forEach((radio) => { expect(radio.attributes('disabled')).toBe('disabled'); }); }); diff --git a/spec/frontend/integrations/edit/components/trigger_fields_spec.js b/spec/frontend/integrations/edit/components/trigger_fields_spec.js index df12c70f9f5..3fa1e5b5f5a 100644 --- a/spec/frontend/integrations/edit/components/trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/trigger_fields_spec.js @@ -29,7 +29,7 @@ describe('TriggerFields', () => { const findAllGlFormCheckboxes = () => wrapper.findAll(GlFormCheckbox); const findAllGlFormInputs = () => wrapper.findAll(GlFormInput); - describe.each([true, false])('template, isInheriting = `%p`', isInheriting => { + describe.each([true, false])('template, isInheriting = `%p`', (isInheriting) => { it('renders a label with text "Trigger"', () => { createComponent(); |