Commit bdefcb44 authored by Mark Florian's avatar Mark Florian

Merge branch 'cngo-make-closed-issue-due-date-gray' into 'master'

Show due date in gray when issue is closed in issues list

See merge request gitlab-org/gitlab!67874
parents 17fb350f d4c66ab0
...@@ -48,8 +48,8 @@ export default { ...@@ -48,8 +48,8 @@ export default {
dueDate() { dueDate() {
return this.issue.dueDate && dateInWords(new Date(this.issue.dueDate), true); return this.issue.dueDate && dateInWords(new Date(this.issue.dueDate), true);
}, },
isDueDateInPast() { showDueDateInRed() {
return isInPast(new Date(this.issue.dueDate)); return isInPast(new Date(this.issue.dueDate)) && !this.issue.closedAt;
}, },
timeEstimate() { timeEstimate() {
return this.issue.humanTimeEstimate || this.issue.timeStats?.humanTimeEstimate; return this.issue.humanTimeEstimate || this.issue.timeStats?.humanTimeEstimate;
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
v-if="issue.dueDate" v-if="issue.dueDate"
v-gl-tooltip v-gl-tooltip
class="issuable-due-date gl-display-none gl-sm-display-inline-block! gl-mr-3" class="issuable-due-date gl-display-none gl-sm-display-inline-block! gl-mr-3"
:class="{ 'gl-text-red-500': isDueDateInPast }" :class="{ 'gl-text-red-500': showDueDateInRed }"
:title="__('Due date')" :title="__('Due date')"
data-testid="issuable-due-date" data-testid="issuable-due-date"
> >
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
= sprite_icon('clock', css_class: 'gl-vertical-align-text-bottom') = sprite_icon('clock', css_class: 'gl-vertical-align-text-bottom')
= issue.milestone.title = issue.milestone.title
- if issue.due_date - if issue.due_date
%span.issuable-due-date.d-none.d-sm-inline-block.has-tooltip{ class: "#{'cred' if issue.overdue?}", title: _('Due date') } %span.issuable-due-date.d-none.d-sm-inline-block.has-tooltip{ class: "#{'cred' if issue.overdue? && !issue.closed?}", title: _('Due date') }
   
= sprite_icon('calendar') = sprite_icon('calendar')
= issue.due_date.to_s(:medium) = issue.due_date.to_s(:medium)
......
...@@ -24,6 +24,7 @@ describe('IssuesListApp component', () => { ...@@ -24,6 +24,7 @@ describe('IssuesListApp component', () => {
const findDueDate = () => wrapper.find('[data-testid="issuable-due-date"]'); const findDueDate = () => wrapper.find('[data-testid="issuable-due-date"]');
const mountComponent = ({ const mountComponent = ({
closedAt = null,
dueDate = issue.dueDate, dueDate = issue.dueDate,
milestoneDueDate = issue.milestone.dueDate, milestoneDueDate = issue.milestone.dueDate,
milestoneStartDate = issue.milestone.startDate, milestoneStartDate = issue.milestone.startDate,
...@@ -37,6 +38,7 @@ describe('IssuesListApp component', () => { ...@@ -37,6 +38,7 @@ describe('IssuesListApp component', () => {
dueDate: milestoneDueDate, dueDate: milestoneDueDate,
startDate: milestoneStartDate, startDate: milestoneStartDate,
}, },
closedAt,
dueDate, dueDate,
}, },
}, },
...@@ -87,10 +89,23 @@ describe('IssuesListApp component', () => { ...@@ -87,10 +89,23 @@ describe('IssuesListApp component', () => {
}); });
describe('when in the past', () => { describe('when in the past', () => {
it('renders in red', () => { describe('when issue is open', () => {
wrapper = mountComponent({ dueDate: new Date('2020-10-10') }); it('renders in red', () => {
wrapper = mountComponent({ dueDate: new Date('2020-10-10') });
expect(findDueDate().classes()).toContain('gl-text-red-500'); expect(findDueDate().classes()).toContain('gl-text-red-500');
});
});
describe('when issue is closed', () => {
it('does not render in red', () => {
wrapper = mountComponent({
dueDate: new Date('2020-10-10'),
closedAt: '2020-09-05T13:06:25Z',
});
expect(findDueDate().classes()).not.toContain('gl-text-red-500');
});
}); });
}); });
}); });
......
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