Commit 93f0e5d8 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Show closed epics in roadmap

parent cd753a8c
......@@ -213,7 +213,9 @@ export const getEpicsPathForPreset = ({
const startDate = `${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`;
const endDate = `${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()}`;
epicsPath += `?start_date=${startDate}&end_date=${endDate}`;
epicsPath += epicsPath.indexOf('?') > -1 ? '&' : '?';
epicsPath += `start_date=${startDate}&end_date=${endDate}`;
if (filterQueryString) {
epicsPath += `&${filterQueryString}`;
......
......@@ -9,6 +9,6 @@
- if @epics_count != 0
= render 'shared/epic/search_bar', type: :epics, show_roadmap_presets: true
#js-roadmap{ data: { epics_path: group_epics_path(@group, format: :json), group_id: @group.id, empty_state_illustration: image_path('illustrations/epics/roadmap.svg'), has_filters_applied: "#{has_filters_applied}", new_epic_endpoint: group_epics_path(@group), preset_type: roadmap_layout } }
#js-roadmap{ data: { epics_path: group_epics_path(@group, state: 'all', format: :json), group_id: @group.id, empty_state_illustration: image_path('illustrations/epics/roadmap.svg'), has_filters_applied: "#{has_filters_applied}", new_epic_endpoint: group_epics_path(@group), preset_type: roadmap_layout } }
- else
= render 'shared/empty_states/roadmap'
......@@ -27,6 +27,7 @@ describe 'group epic roadmap', :js do
context 'when epics exist for the group' do
let!(:epic_with_bug) { create(:labeled_epic, group: group, start_date: 10.days.ago, end_date: 1.day.ago, labels: [bug_label]) }
let!(:epic_with_critical) { create(:labeled_epic, group: group, start_date: 20.days.ago, end_date: 2.days.ago, labels: [critical_label]) }
let!(:closed_epic) { create(:epic, :closed, group: group, start_date: 20.days.ago, end_date: 2.days.ago) }
before do
visit group_roadmap_path(group)
......@@ -70,7 +71,7 @@ describe 'group epic roadmap', :js do
it 'renders all group epics within roadmap' do
page.within('.roadmap-container .epics-list-section') do
expect(page).to have_selector('.epics-list-item .epic-title', count: 2)
expect(page).to have_selector('.epics-list-item .epic-title', count: 3)
end
end
end
......
......@@ -187,4 +187,20 @@ describe('getEpicsPathForPreset', () => {
`${basePath}?start_date=2017-12-1&end_date=2018-6-30&scope=all&utf8=✓&state=opened&label_name[]=Bug`,
);
});
it('returns epics path string when basePath already contains a query param', () => {
const basePathWithQuery = `${basePath}?state=all`;
const timeframeMonths = getTimeframeForMonthsView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
basePath: basePathWithQuery,
filterQueryString,
timeframe: timeframeMonths,
presetType: PRESET_TYPES.MONTHS,
});
expect(epicsPath).toBe(
`${basePathWithQuery}&start_date=2017-12-1&end_date=2018-6-30&scope=all&utf8=✓&state=opened&label_name[]=Bug`,
);
});
});
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