Commit c35f8107 authored by Kushal Pandya's avatar Kushal Pandya

Hide filters UI in Roadmap within epic page

- Hides filtering UI while roadmap data is being loaded
within an epic page.
- Cleans up Roadmap component tests

Changelog: fixed
EE: true
parent 532e3e3e
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'currentGroupId', 'currentGroupId',
'epicIid',
'epics', 'epics',
'milestones', 'milestones',
'timeframe', 'timeframe',
...@@ -158,7 +159,10 @@ export default { ...@@ -158,7 +159,10 @@ export default {
<template> <template>
<div class="roadmap-app-container gl-h-full"> <div class="roadmap-app-container gl-h-full">
<roadmap-filters v-if="showFilteredSearchbar" :timeframe-range-type="timeframeRangeType" /> <roadmap-filters
v-if="showFilteredSearchbar && !epicIid"
:timeframe-range-type="timeframeRangeType"
/>
<gl-alert <gl-alert
v-if="isWarningVisible" v-if="isWarningVisible"
variant="warning" variant="warning"
......
...@@ -106,32 +106,17 @@ describe('RoadmapApp', () => { ...@@ -106,32 +106,17 @@ describe('RoadmapApp', () => {
store.commit(types.RECEIVE_EPICS_SUCCESS, { epics: [] }); store.commit(types.RECEIVE_EPICS_SUCCESS, { epics: [] });
}); });
it('contains path for the empty state illustration', () => { it('shows epic-list-empty component', () => {
expect(wrapper.find(EpicsListEmpty).props('emptyStateIllustrationPath')).toBe( const epicsListEmpty = wrapper.findComponent(EpicsListEmpty);
expect(epicsListEmpty.exists()).toBe(true);
expect(epicsListEmpty.props()).toMatchObject({
emptyStateIllustrationPath, emptyStateIllustrationPath,
); hasFiltersApplied,
}); presetType,
timeframeStart: timeframe[0],
it('contains whether to apply filters', () => { timeframeEnd: timeframe[timeframe.length - 1],
expect(wrapper.find(EpicsListEmpty).props('hasFiltersApplied')).toBe(hasFiltersApplied); isChildEpics: false,
});
it('contains whether it is child epics', () => {
expect(wrapper.find(EpicsListEmpty).props('isChildEpics')).toBe(false);
});
it('contains the preset type', () => {
expect(wrapper.find(EpicsListEmpty).props('presetType')).toBe(presetType);
});
it('contains the start of the timeframe', () => {
expect(wrapper.find(EpicsListEmpty).props('timeframeStart')).toStrictEqual(timeframe[0]);
}); });
it('contains the end of the timeframe', () => {
expect(wrapper.find(EpicsListEmpty).props('timeframeEnd')).toStrictEqual(
timeframe[timeframe.length - 1],
);
}); });
}); });
...@@ -141,32 +126,32 @@ describe('RoadmapApp', () => { ...@@ -141,32 +126,32 @@ describe('RoadmapApp', () => {
store.commit(types.RECEIVE_EPICS_SUCCESS, { epics }); store.commit(types.RECEIVE_EPICS_SUCCESS, { epics });
}); });
it('contains roadmap filters UI', () => { it('does not show filters UI when epicIid is present', async () => {
expect(wrapper.find(RoadmapFilters).exists()).toBe(true); store.dispatch('setInitialData', {
}); epicIid: mockFormattedEpic.iid,
it('contains the current group id', () => {
expect(wrapper.find(RoadmapShell).props('currentGroupId')).toBe(currentGroupId);
}); });
it('contains epics', () => { await wrapper.vm.$nextTick();
expect(wrapper.find(RoadmapShell).props('epics')).toEqual(epics);
});
it('contains whether filters are applied', () => { expect(wrapper.findComponent(RoadmapFilters).exists()).toBe(false);
expect(wrapper.find(RoadmapShell).props('hasFiltersApplied')).toBe(hasFiltersApplied);
}); });
it('contains milestones', () => { it('shows roadmap filters UI when epicIid is not present', () => {
expect(wrapper.find(RoadmapShell).props('milestones')).toEqual([]); // By default, `epicIid` is not set on store.
expect(wrapper.findComponent(RoadmapFilters).exists()).toBe(true);
}); });
it('contains the preset type', () => { it('shows roadmap-shell component', () => {
expect(wrapper.find(RoadmapShell).props('presetType')).toBe(presetType); const roadmapShell = wrapper.findComponent(RoadmapShell);
expect(wrapper.find(RoadmapShell).exists()).toBe(true);
expect(roadmapShell.props()).toMatchObject({
currentGroupId,
epics,
hasFiltersApplied,
presetType,
timeframe,
milestones: [],
}); });
it('contains timeframe', () => {
expect(wrapper.find(RoadmapShell).props('timeframe')).toEqual(timeframe);
}); });
}); });
......
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