Commit 2e4cac94 authored by Kushal Pandya's avatar Kushal Pandya

Pass `presetType` prop

parent 8c53f838
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
type: Object, type: Object,
required: true, required: true,
}, },
presetType: {
type: String,
required: true,
},
hasFiltersApplied: { hasFiltersApplied: {
type: Boolean, type: Boolean,
required: true, required: true,
...@@ -129,12 +133,14 @@ ...@@ -129,12 +133,14 @@
/> />
<roadmap-shell <roadmap-shell
v-if="showRoadmap" v-if="showRoadmap"
:preset-type="presetType"
:epics="epics" :epics="epics"
:timeframe="timeframe" :timeframe="timeframe"
:current-group-id="currentGroupId" :current-group-id="currentGroupId"
/> />
<epics-list-empty <epics-list-empty
v-if="isEpicsListEmpty" v-if="isEpicsListEmpty"
:preset-type="presetType"
:timeframe-start="timeframeStart" :timeframe-start="timeframeStart"
:timeframe-end="timeframeEnd" :timeframe-end="timeframeEnd"
:has-filters-applied="hasFiltersApplied" :has-filters-applied="hasFiltersApplied"
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
epicItemTimeline, epicItemTimeline,
}, },
props: { props: {
presetType: {
type: String,
required: true,
},
epic: { epic: {
type: Object, type: Object,
required: true, required: true,
...@@ -41,6 +45,7 @@ ...@@ -41,6 +45,7 @@
<epic-item-timeline <epic-item-timeline
v-for="(timeframeItem, index) in timeframe" v-for="(timeframeItem, index) in timeframe"
:key="index" :key="index"
:preset-type="presetType"
:timeframe="timeframe" :timeframe="timeframe"
:timeframe-item="timeframeItem" :timeframe-item="timeframeItem"
:epic="epic" :epic="epic"
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
SectionMixin, SectionMixin,
], ],
props: { props: {
presetType: {
type: String,
required: true,
},
epics: { epics: {
type: Array, type: Array,
required: true, required: true,
...@@ -148,6 +152,7 @@ ...@@ -148,6 +152,7 @@
<epic-item <epic-item
v-for="(epic, index) in epics" v-for="(epic, index) in epics"
:key="index" :key="index"
:preset-type="presetType"
:epic="epic" :epic="epic"
:timeframe="timeframe" :timeframe="timeframe"
:current-group-id="currentGroupId" :current-group-id="currentGroupId"
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
roadmapTimelineSection, roadmapTimelineSection,
}, },
props: { props: {
presetType: {
type: String,
required: true,
},
epics: { epics: {
type: Array, type: Array,
required: true, required: true,
...@@ -65,9 +69,7 @@ ...@@ -65,9 +69,7 @@
}, },
handleScroll() { handleScroll() {
const { scrollTop, scrollLeft, clientHeight, scrollHeight } = this.$el; const { scrollTop, scrollLeft, clientHeight, scrollHeight } = this.$el;
if (!this.noScroll) { eventHub.$emit('epicsListScrolled', { scrollTop, scrollLeft, clientHeight, scrollHeight });
eventHub.$emit('epicsListScrolled', { scrollTop, scrollLeft, clientHeight, scrollHeight });
}
}, },
}, },
}; };
...@@ -81,12 +83,14 @@ ...@@ -81,12 +83,14 @@
@scroll="handleScroll" @scroll="handleScroll"
> >
<roadmap-timeline-section <roadmap-timeline-section
:preset-type="presetType"
:epics="epics" :epics="epics"
:timeframe="timeframe" :timeframe="timeframe"
:shell-width="shellWidth" :shell-width="shellWidth"
:list-scrollable="!noScroll" :list-scrollable="!noScroll"
/> />
<epics-list-section <epics-list-section
:preset-type="presetType"
:epics="epics" :epics="epics"
:timeframe="timeframe" :timeframe="timeframe"
:shell-width="shellWidth" :shell-width="shellWidth"
......
...@@ -7,12 +7,14 @@ import appComponent from 'ee/roadmap/components/app.vue'; ...@@ -7,12 +7,14 @@ import appComponent from 'ee/roadmap/components/app.vue';
import RoadmapStore from 'ee/roadmap/store/roadmap_store'; import RoadmapStore from 'ee/roadmap/store/roadmap_store';
import RoadmapService from 'ee/roadmap/service/roadmap_service'; import RoadmapService from 'ee/roadmap/service/roadmap_service';
import { PRESET_TYPES } from 'ee/roadmap/constants';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { mockTimeframe, mockGroupId, epicsPath, mockNewEpicEndpoint, rawEpics, mockSvgPath } from '../mock_data'; import { mockTimeframeMonths, mockGroupId, epicsPath, mockNewEpicEndpoint, rawEpics, mockSvgPath } from '../mock_data';
const createComponent = () => { const createComponent = () => {
const Component = Vue.extend(appComponent); const Component = Vue.extend(appComponent);
const timeframe = mockTimeframe; const timeframe = mockTimeframeMonths;
const store = new RoadmapStore(mockGroupId, timeframe); const store = new RoadmapStore(mockGroupId, timeframe);
const service = new RoadmapService(epicsPath); const service = new RoadmapService(epicsPath);
...@@ -20,6 +22,7 @@ const createComponent = () => { ...@@ -20,6 +22,7 @@ const createComponent = () => {
return mountComponent(Component, { return mountComponent(Component, {
store, store,
service, service,
presetType: PRESET_TYPES.MONTHS,
hasFiltersApplied: true, hasFiltersApplied: true,
newEpicEndpoint: mockNewEpicEndpoint, newEpicEndpoint: mockNewEpicEndpoint,
emptyStateIllustrationPath: mockSvgPath, emptyStateIllustrationPath: mockSvgPath,
......
...@@ -2,12 +2,15 @@ import Vue from 'vue'; ...@@ -2,12 +2,15 @@ import Vue from 'vue';
import epicItemComponent from 'ee/roadmap/components/epic_item.vue'; import epicItemComponent from 'ee/roadmap/components/epic_item.vue';
import { PRESET_TYPES } from 'ee/roadmap/constants';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { mockTimeframe, mockEpic, mockGroupId, mockShellWidth, mockItemWidth } from '../mock_data'; import { mockTimeframeMonths, mockEpic, mockGroupId, mockShellWidth, mockItemWidth } from '../mock_data';
const createComponent = ({ const createComponent = ({
presetType = PRESET_TYPES.MONTHS,
epic = mockEpic, epic = mockEpic,
timeframe = mockTimeframe, timeframe = mockTimeframeMonths,
currentGroupId = mockGroupId, currentGroupId = mockGroupId,
shellWidth = mockShellWidth, shellWidth = mockShellWidth,
itemWidth = mockItemWidth, itemWidth = mockItemWidth,
...@@ -15,6 +18,7 @@ const createComponent = ({ ...@@ -15,6 +18,7 @@ const createComponent = ({
const Component = Vue.extend(epicItemComponent); const Component = Vue.extend(epicItemComponent);
return mountComponent(Component, { return mountComponent(Component, {
presetType,
epic, epic,
timeframe, timeframe,
currentGroupId, currentGroupId,
......
...@@ -3,23 +3,26 @@ import Vue from 'vue'; ...@@ -3,23 +3,26 @@ import Vue from 'vue';
import epicsListSectionComponent from 'ee/roadmap/components/epics_list_section.vue'; import epicsListSectionComponent from 'ee/roadmap/components/epics_list_section.vue';
import RoadmapStore from 'ee/roadmap/store/roadmap_store'; import RoadmapStore from 'ee/roadmap/store/roadmap_store';
import eventHub from 'ee/roadmap/event_hub'; import eventHub from 'ee/roadmap/event_hub';
import { PRESET_TYPES } from 'ee/roadmap/constants';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { rawEpics, mockTimeframe, mockGroupId, mockShellWidth } from '../mock_data'; import { rawEpics, mockTimeframeMonths, mockGroupId, mockShellWidth } from '../mock_data';
const store = new RoadmapStore(mockGroupId, mockTimeframe); const store = new RoadmapStore(mockGroupId, mockTimeframeMonths, PRESET_TYPES.MONTHS);
store.setEpics(rawEpics); store.setEpics(rawEpics);
const mockEpics = store.getEpics(); const mockEpics = store.getEpics();
const createComponent = ({ const createComponent = ({
epics = mockEpics, epics = mockEpics,
timeframe = mockTimeframe, timeframe = mockTimeframeMonths,
currentGroupId = mockGroupId, currentGroupId = mockGroupId,
shellWidth = mockShellWidth, shellWidth = mockShellWidth,
listScrollable = false, listScrollable = false,
presetType = PRESET_TYPES.MONTHS,
}) => { }) => {
const Component = Vue.extend(epicsListSectionComponent); const Component = Vue.extend(epicsListSectionComponent);
return mountComponent(Component, { return mountComponent(Component, {
presetType,
epics, epics,
timeframe, timeframe,
currentGroupId, currentGroupId,
...@@ -59,7 +62,7 @@ describe('EpicsListSectionComponent', () => { ...@@ -59,7 +62,7 @@ describe('EpicsListSectionComponent', () => {
describe('emptyRowCellStyles', () => { describe('emptyRowCellStyles', () => {
it('returns computed style object based on sectionItemWidth prop value', () => { it('returns computed style object based on sectionItemWidth prop value', () => {
expect(vm.emptyRowCellStyles.width).toBe('280px'); expect(vm.emptyRowCellStyles.width).toBe('240px');
}); });
}); });
......
...@@ -3,17 +3,20 @@ import Vue from 'vue'; ...@@ -3,17 +3,20 @@ import Vue from 'vue';
import roadmapShellComponent from 'ee/roadmap/components/roadmap_shell.vue'; import roadmapShellComponent from 'ee/roadmap/components/roadmap_shell.vue';
import eventHub from 'ee/roadmap/event_hub'; import eventHub from 'ee/roadmap/event_hub';
import { PRESET_TYPES } from 'ee/roadmap/constants';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { mockEpic, mockTimeframe, mockGroupId, mockScrollBarSize } from '../mock_data'; import { mockEpic, mockTimeframeMonths, mockGroupId, mockScrollBarSize } from '../mock_data';
const createComponent = ({ const createComponent = ({
epics = [mockEpic], epics = [mockEpic],
timeframe = mockTimeframe, timeframe = mockTimeframeMonths,
currentGroupId = mockGroupId, currentGroupId = mockGroupId,
}, el) => { }, el) => {
const Component = Vue.extend(roadmapShellComponent); const Component = Vue.extend(roadmapShellComponent);
return mountComponent(Component, { return mountComponent(Component, {
presetType: PRESET_TYPES.MONTHS,
epics, epics,
timeframe, timeframe,
currentGroupId, currentGroupId,
...@@ -82,17 +85,11 @@ describe('RoadmapShellComponent', () => { ...@@ -82,17 +85,11 @@ describe('RoadmapShellComponent', () => {
spyOn(eventHub, '$emit'); spyOn(eventHub, '$emit');
}); });
it('emits `epicsListScrolled` event via eventHub when `noScroll` prop is false', () => { it('emits `epicsListScrolled` event via eventHub', () => {
vm.noScroll = false; vm.noScroll = false;
vm.handleScroll(); vm.handleScroll();
expect(eventHub.$emit).toHaveBeenCalledWith('epicsListScrolled', jasmine.any(Object)); expect(eventHub.$emit).toHaveBeenCalledWith('epicsListScrolled', jasmine.any(Object));
}); });
it('does not emit any event via eventHub when `noScroll` prop is true', () => {
vm.noScroll = true;
vm.handleScroll();
expect(eventHub.$emit).not.toHaveBeenCalled();
});
}); });
}); });
......
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