Commit 3a51227b authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '218698-adding-existing-issue-to-an-epic-shows-incorrect-form' into 'master'

Fix "Add an existing issue" button in Epic showing incorrect form

See merge request gitlab-org/gitlab!32858
parents 3a4f1f24 0ee6d9aa
......@@ -33,6 +33,11 @@ export default {
required: false,
default: () => ({}),
},
isLinkedIssueBlock: {
type: Boolean,
required: false,
default: false,
},
isSubmitting: {
type: Boolean,
required: false,
......@@ -83,9 +88,6 @@ export default {
};
},
computed: {
isIssue() {
return this.issuableType === issuableTypesMap.ISSUE;
},
isSubmitButtonDisabled() {
return (
(this.inputValue.length === 0 && this.pendingReferences.length === 0) || this.isSubmitting
......@@ -126,7 +128,7 @@ export default {
<template>
<form @submit.prevent="onFormSubmit">
<template v-if="isIssue">
<template v-if="isLinkedIssueBlock">
<gl-form-group
:label="__('The current issue')"
label-for="linked-issue-type-radio"
......
......@@ -169,6 +169,7 @@ export default {
class="js-add-related-issues-form-area card-body bordered-box bg-white"
>
<add-issuable-form
:is-linked-issue-block="true"
:is-submitting="isSubmitting"
:issuable-type="issuableType"
:input-value="inputValue"
......
......@@ -244,5 +244,14 @@ describe 'Epic Issues', :js do
expect(page).to have_selector('li.js-item-type-issue', count: 3)
end
end
it 'user does not see the linked issues part of the form when they click "Add an existing issue"' do
find(".related-items-tree-container .js-add-epics-issues-button").click
find('.related-items-tree-container .js-add-epics-issues-button .dropdown-item', text: 'Add an existing issue').click
expect(page).not_to have_content("The current issue")
expect(page).not_to have_content("is blocked by")
expect(page).not_to have_content("the following issue(s)")
end
end
end
......@@ -113,6 +113,41 @@ describe('AddIssuableForm', () => {
});
});
it('does not show radio inputs', () => {
expect(findRadioInputs(wrapper).length).toBe(0);
});
});
describe('when issuable type is "epic"', () => {
beforeEach(() => {
wrapper = shallowMount(AddIssuableForm, {
propsData: {
inputValue: '',
issuableType: issuableTypesMap.EPIC,
pathIdSeparator,
pendingReferences: [],
},
});
});
it('does not show radio inputs', () => {
expect(findRadioInputs(wrapper).length).toBe(0);
});
});
describe('when it is a Linked Issues form', () => {
beforeEach(() => {
wrapper = mount(AddIssuableForm, {
propsData: {
inputValue: '',
isLinkedIssueBlock: true,
issuableType: issuableTypesMap.ISSUE,
pathIdSeparator,
pendingReferences: [],
},
});
});
it('shows radio inputs to allow categorisation of blocking issues', () => {
expect(findRadioInputs(wrapper).length).toBeGreaterThan(0);
});
......@@ -202,22 +237,5 @@ describe('AddIssuableForm', () => {
});
});
});
describe('when issuable type is "epic"', () => {
beforeEach(() => {
wrapper = shallowMount(AddIssuableForm, {
propsData: {
inputValue: '',
issuableType: issuableTypesMap.EPIC,
pathIdSeparator,
pendingReferences: [],
},
});
});
it('does not show radio inputs', () => {
expect(findRadioInputs(wrapper).length).toBe(0);
});
});
});
});
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