Commit 286c7fe3 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '10543-fix-epic-date-save' into 'master'

Fix date save for Epic to reflect on UI immediately after save

Closes #10543

See merge request gitlab-org/gitlab-ee!10321
parents fc396534 cc8dfdb3
......@@ -246,8 +246,8 @@ export default {
css-classes="date-warning-icon append-right-5 prepend-left-5"
tab-index="0"
/>
<span v-if="selectedAndEditable" class="no-value">
&nbsp;&ndash;
<span v-if="selectedAndEditable" class="no-value d-flex">
&nbsp;&ndash;&nbsp;
<gl-button
variant="link"
class="btn-sidebar-date-remove"
......
......@@ -58,10 +58,18 @@ export default {
state.epicStartDateSaveInProgress = false;
state.startDateIsFixed = dateTypeIsFixed;
state.startDate = newDate;
if (dateTypeIsFixed) {
state.startDateFixed = newDate;
}
} else {
state.epicDueDateSaveInProgress = false;
state.dueDateIsFixed = dateTypeIsFixed;
state.dueDate = newDate;
if (dateTypeIsFixed) {
state.dueDateFixed = newDate;
}
}
},
[types.REQUEST_EPIC_DATE_SAVE_FAILURE](state, { dateType, dateTypeIsFixed }) {
......
---
title: Fix date save for Epic to reflect on UI immediately after save
merge_request: 10321
author:
type: fixed
......@@ -189,6 +189,7 @@ describe('Epic Store Mutations', () => {
expect(state.epicStartDateSaveInProgress).toBe(false);
expect(state.startDateIsFixed).toBe(startDateIsFixed);
expect(state.startDate).toBe(startDate);
expect(state.startDateFixed).toBe(startDate);
});
it('Should set `epicDueDateSaveInProgress` flag on state to `false` and set `dueDateIsFixed` & `dueDate` values based on provided `dateTypeIsFixed` & `newDate` params when `dateType` param is `due`', () => {
......@@ -205,6 +206,35 @@ describe('Epic Store Mutations', () => {
expect(state.epicDueDateSaveInProgress).toBe(false);
expect(state.dueDateIsFixed).toBe(dueDateIsFixed);
expect(state.dueDate).toBe(dueDate);
expect(state.dueDateFixed).toBe(dueDate);
});
it('Should not set `startDateFixed` on state when date changed is not of type fixed', () => {
const startDateIsFixed = false;
const startDate = '2018-1-1';
const state = {};
mutations[types.REQUEST_EPIC_DATE_SAVE_SUCCESS](state, {
dateType: dateTypes.start,
dateTypeIsFixed: startDateIsFixed,
newDate: startDate,
});
expect(state.startDateFixed).toBeUndefined();
});
it('Should not set `dueDateFixed` on state when date changed is not of type fixed', () => {
const dueDateIsFixed = false;
const dueDate = '2018-1-1';
const state = {};
mutations[types.REQUEST_EPIC_DATE_SAVE_SUCCESS](state, {
dateType: dateTypes.due,
dateTypeIsFixed: dueDateIsFixed,
newDate: dueDate,
});
expect(state.dueDateFixed).toBeUndefined();
});
});
......
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