diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 18:09:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 18:09:19 +0000 |
commit | c0ef148ef349f0d13331638ab90f5d9e9d2175ba (patch) | |
tree | fd826213aa30339d8fee4bcc1bf35c6e40639823 /spec/frontend/integrations | |
parent | c982bb363b3a0390a274197f410a1609a4667760 (diff) | |
download | gitlab-ce-c0ef148ef349f0d13331638ab90f5d9e9d2175ba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/integrations')
-rw-r--r-- | spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js | 59 |
1 files changed, 49 insertions, 10 deletions
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 c6e7ee44355..6a8ab02a69a 100644 --- a/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js +++ b/spec/frontend/integrations/edit/components/jira_trigger_fields_spec.js @@ -30,14 +30,21 @@ describe('JiraTriggerFields', () => { const findCommentSettings = () => wrapper.find('[data-testid="comment-settings"]'); const findCommentDetail = () => wrapper.find('[data-testid="comment-detail"]'); const findCommentSettingsCheckbox = () => findCommentSettings().find(GlFormCheckbox); + const findIssueTransitionSettings = () => + wrapper.find('[data-testid="issue-transition-settings"]'); + const findIssueTransitionModeRadios = () => + findIssueTransitionSettings().findAll('input[type="radio"]'); + const findIssueTransitionIdsField = () => + wrapper.find('input[type="text"][name="service[jira_issue_transition_id]"]'); describe('template', () => { describe('initialTriggerCommit and initialTriggerMergeRequest are false', () => { - it('does not show comment settings', () => { + it('does not show trigger settings', () => { createComponent(); expect(findCommentSettings().isVisible()).toBe(false); expect(findCommentDetail().isVisible()).toBe(false); + expect(findIssueTransitionSettings().isVisible()).toBe(false); }); }); @@ -48,9 +55,10 @@ describe('JiraTriggerFields', () => { }); }); - it('shows comment settings', () => { + it('shows trigger settings', () => { expect(findCommentSettings().isVisible()).toBe(true); expect(findCommentDetail().isVisible()).toBe(false); + expect(findIssueTransitionSettings().isVisible()).toBe(true); }); // As per https://vuejs.org/v2/guide/forms.html#Checkbox-1, @@ -73,13 +81,14 @@ describe('JiraTriggerFields', () => { }); describe('initialTriggerMergeRequest is true', () => { - it('shows comment settings', () => { + it('shows trigger settings', () => { createComponent({ initialTriggerMergeRequest: true, }); expect(findCommentSettings().isVisible()).toBe(true); expect(findCommentDetail().isVisible()).toBe(false); + expect(findIssueTransitionSettings().isVisible()).toBe(true); }); }); @@ -95,7 +104,41 @@ describe('JiraTriggerFields', () => { }); }); - it('disables checkboxes and radios if inheriting', () => { + describe('initialJiraIssueTransitionId is not set', () => { + it('uses automatic transitions', () => { + createComponent({ + initialTriggerCommit: true, + }); + + const [radio1, radio2] = findIssueTransitionModeRadios().wrappers; + expect(radio1.element.checked).toBe(true); + expect(radio2.element.checked).toBe(false); + + expect(findIssueTransitionIdsField().exists()).toBe(false); + }); + }); + + describe('initialJiraIssueTransitionId is set', () => { + it('uses custom transitions', () => { + createComponent({ + initialJiraIssueTransitionId: '1, 2, 3', + initialTriggerCommit: true, + }); + + const [radio1, radio2] = findIssueTransitionModeRadios().wrappers; + expect(radio1.element.checked).toBe(false); + expect(radio2.element.checked).toBe(true); + + const field = findIssueTransitionIdsField(); + expect(field.isVisible()).toBe(true); + expect(field.element).toMatchObject({ + type: 'text', + value: '1, 2, 3', + }); + }); + }); + + it('disables input fields if inheriting', () => { createComponent( { initialTriggerCommit: true, @@ -104,12 +147,8 @@ describe('JiraTriggerFields', () => { true, ); - wrapper.findAll('[type=checkbox]').wrappers.forEach((checkbox) => { - expect(checkbox.attributes('disabled')).toBe('disabled'); - }); - - wrapper.findAll('[type=radio]').wrappers.forEach((radio) => { - expect(radio.attributes('disabled')).toBe('disabled'); + wrapper.findAll('[type=text], [type=checkbox], [type=radio]').wrappers.forEach((input) => { + expect(input.attributes('disabled')).toBe('disabled'); }); }); }); |