Commit 1e87fad1 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '342758-disable-start-date-when-iteration-cadence-is-in-manual-mode' into 'master'

Disable start date when iteration cadence is in "manual" mode

See merge request gitlab-org/gitlab!75167
parents e4bbf8f8 9084b7b8
...@@ -208,7 +208,11 @@ export default { ...@@ -208,7 +208,11 @@ export default {
if (this.automatic) { if (this.automatic) {
return true; return true;
} }
const requiredFieldsForAutomatedScheduling = ['iterationsInAdvance', 'durationInWeeks']; const requiredFieldsForAutomatedScheduling = [
'iterationsInAdvance',
'durationInWeeks',
'startDate',
];
return !requiredFieldsForAutomatedScheduling.includes(field); return !requiredFieldsForAutomatedScheduling.includes(field);
}) })
.forEach((field) => { .forEach((field) => {
...@@ -223,6 +227,7 @@ export default { ...@@ -223,6 +227,7 @@ export default {
updateAutomatic(value) { updateAutomatic(value) {
this.clearValidation(); this.clearValidation();
if (!value) { if (!value) {
this.startDate = null;
this.iterationsInAdvance = 0; this.iterationsInAdvance = 0;
this.durationInWeeks = 0; this.durationInWeeks = 0;
} }
...@@ -362,9 +367,9 @@ export default { ...@@ -362,9 +367,9 @@ export default {
class="datepicker gl-datepicker-input" class="datepicker gl-datepicker-input"
autocomplete="off" autocomplete="off"
inputmode="none" inputmode="none"
required :required="automatic"
:disabled="loadingCadence || !automatic"
:state="validationState.startDate" :state="validationState.startDate"
:disabled="loadingCadence"
data-qa-selector="iteration_cadence_start_date_field" data-qa-selector="iteration_cadence_start_date_field"
@blur="validate('startDate')" @blur="validate('startDate')"
/> />
...@@ -391,17 +396,6 @@ export default { ...@@ -391,17 +396,6 @@ export default {
/> />
</gl-form-group> </gl-form-group>
<gl-form-group
:label-cols-md="2"
label-class="gl-font-weight-bold text-right-md gl-pt-3!"
label-for="cadence-rollover-issues"
:description="i18n.rollOver.description"
>
<gl-form-checkbox id="cadence-rollover-issues" v-model="rollOver" @change="clearValidation">
<span class="gl-font-weight-bold">{{ i18n.rollOver.label }}</span>
</gl-form-checkbox>
</gl-form-group>
<gl-form-group <gl-form-group
:label="i18n.futureIterations.label" :label="i18n.futureIterations.label"
:label-cols-md="2" :label-cols-md="2"
...@@ -423,6 +417,17 @@ export default { ...@@ -423,6 +417,17 @@ export default {
/> />
</gl-form-group> </gl-form-group>
<gl-form-group
:label-cols-md="2"
label-class="gl-font-weight-bold text-right-md gl-pt-3!"
label-for="cadence-rollover-issues"
:description="i18n.rollOver.description"
>
<gl-form-checkbox id="cadence-rollover-issues" v-model="rollOver" @change="clearValidation">
<span class="gl-font-weight-bold">{{ i18n.rollOver.label }}</span>
</gl-form-checkbox>
</gl-form-group>
<gl-form-group <gl-form-group
:label="i18n.description.label" :label="i18n.description.label"
:label-cols-md="2" :label-cols-md="2"
......
...@@ -83,8 +83,8 @@ describe('Iteration cadence form', () => { ...@@ -83,8 +83,8 @@ describe('Iteration cadence form', () => {
const findAutomatedSchedulingGroup = () => wrapper.findAllComponents(GlFormGroup).at(1); const findAutomatedSchedulingGroup = () => wrapper.findAllComponents(GlFormGroup).at(1);
const findStartDateGroup = () => wrapper.findAllComponents(GlFormGroup).at(2); const findStartDateGroup = () => wrapper.findAllComponents(GlFormGroup).at(2);
const findDurationGroup = () => wrapper.findAllComponents(GlFormGroup).at(3); const findDurationGroup = () => wrapper.findAllComponents(GlFormGroup).at(3);
const findRollOverGroup = () => wrapper.findAllComponents(GlFormGroup).at(4); const findFutureIterationsGroup = () => wrapper.findAllComponents(GlFormGroup).at(4);
const findFutureIterationsGroup = () => wrapper.findAllComponents(GlFormGroup).at(5); const findRollOverGroup = () => wrapper.findAllComponents(GlFormGroup).at(5);
const findError = () => wrapper.findComponent(GlAlert); const findError = () => wrapper.findComponent(GlAlert);
...@@ -221,16 +221,17 @@ describe('Iteration cadence form', () => { ...@@ -221,16 +221,17 @@ describe('Iteration cadence form', () => {
setAutomaticValue(false); setAutomaticValue(false);
}); });
it('disables future iterations and duration in weeks', () => { it('disables future iterations, duration in weeks, and start date fields', () => {
expect(findFutureIterations().attributes('disabled')).toBe('disabled'); expect(findFutureIterations().attributes('disabled')).toBe('disabled');
expect(findFutureIterations().attributes('required')).toBeUndefined(); expect(findFutureIterations().attributes('required')).toBeUndefined();
expect(findDuration().attributes('disabled')).toBe('disabled'); expect(findDuration().attributes('disabled')).toBe('disabled');
expect(findDuration().attributes('required')).toBeUndefined(); expect(findDuration().attributes('required')).toBeUndefined();
expect(findStartDate().attributes('disabled')).toBe('disabled');
expect(findStartDate().attributes('required')).toBeUndefined();
}); });
it('sets future iterations and cadence duration to 0', async () => { it('sets future iterations and cadence duration to 0', async () => {
const title = 'Iteration 5'; const title = 'Iteration 5';
const startDate = '2020-05-05';
setFutureIterations(10); setFutureIterations(10);
setDuration(2); setDuration(2);
...@@ -240,7 +241,6 @@ describe('Iteration cadence form', () => { ...@@ -240,7 +241,6 @@ describe('Iteration cadence form', () => {
await nextTick(); await nextTick();
setTitle(title); setTitle(title);
setStartDate(startDate);
clickSave(); clickSave();
...@@ -251,7 +251,7 @@ describe('Iteration cadence form', () => { ...@@ -251,7 +251,7 @@ describe('Iteration cadence form', () => {
groupPath, groupPath,
title, title,
automatic: false, automatic: false,
startDate, startDate: null,
rollOver: false, rollOver: false,
durationInWeeks: 0, durationInWeeks: 0,
iterationsInAdvance: 0, iterationsInAdvance: 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