Commit cc507542 authored by Florie Guibert's avatar Florie Guibert

Refactor roadmap mixins

Refactor roadmap mixins to prepare adding milestones to roadmap
parent e50a6361
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
}, },
computed: { computed: {
epicStartDateValues() { startDateValues() {
const { startDate } = this.epic; const { startDate } = this.epic;
return { return {
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
time: startDate.getTime(), time: startDate.getTime(),
}; };
}, },
epicEndDateValues() { endDateValues() {
const { endDate } = this.epic; const { endDate } = this.epic;
return { return {
...@@ -77,13 +77,19 @@ export default { ...@@ -77,13 +77,19 @@ export default {
if (this.presetTypeQuarters) { if (this.presetTypeQuarters) {
// CSS properties are a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/24 // CSS properties are a false positive: https://gitlab.com/gitlab-org/frontend/eslint-plugin-i18n/issues/24
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
barStyles = `width: ${this.getTimelineBarWidthForQuarters()}px; ${this.getTimelineBarStartOffsetForQuarters()}`; barStyles = `width: ${this.getTimelineBarWidthForQuarters(
this.epic,
)}px; ${this.getTimelineBarStartOffsetForQuarters(this.epic)}`;
} else if (this.presetTypeMonths) { } else if (this.presetTypeMonths) {
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
barStyles = `width: ${this.getTimelineBarWidthForMonths()}px; ${this.getTimelineBarStartOffsetForMonths()}`; barStyles = `width: ${this.getTimelineBarWidthForMonths()}px; ${this.getTimelineBarStartOffsetForMonths(
this.epic,
)}`;
} else if (this.presetTypeWeeks) { } else if (this.presetTypeWeeks) {
// eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
barStyles = `width: ${this.getTimelineBarWidthForWeeks()}px; ${this.getTimelineBarStartOffsetForWeeks()}`; barStyles = `width: ${this.getTimelineBarWidthForWeeks()}px; ${this.getTimelineBarStartOffsetForWeeks(
this.epic,
)}`;
} }
} }
return barStyles; return barStyles;
......
...@@ -7,18 +7,18 @@ export default { ...@@ -7,18 +7,18 @@ export default {
*/ */
hasStartDateForMonth() { hasStartDateForMonth() {
return ( return (
this.epicStartDateValues.month === this.timeframeItem.getMonth() && this.startDateValues.month === this.timeframeItem.getMonth() &&
this.epicStartDateValues.year === this.timeframeItem.getFullYear() this.startDateValues.year === this.timeframeItem.getFullYear()
); );
}, },
/** /**
* Check if current epic ends within current month (timeline cell) * Check if current epic ends within current month (timeline cell)
*/ */
isTimeframeUnderEndDateForMonth(timeframeItem) { isTimeframeUnderEndDateForMonth(timeframeItem) {
if (this.epicEndDateValues.year <= timeframeItem.getFullYear()) { if (this.endDateValues.year <= timeframeItem.getFullYear()) {
return this.epicEndDateValues.month === timeframeItem.getMonth(); return this.endDateValues.month === timeframeItem.getMonth();
} }
return this.epicEndDateValues.time < timeframeItem.getTime(); return this.endDateValues.time < timeframeItem.getTime();
}, },
/** /**
* Return timeline bar width for current month (timeline cell) based on * Return timeline bar width for current month (timeline cell) based on
...@@ -40,13 +40,13 @@ export default { ...@@ -40,13 +40,13 @@ export default {
* 3. A "triangle" shape is shown at the beginning of timeline bar * 3. A "triangle" shape is shown at the beginning of timeline bar
* when startDate is out of range. * when startDate is out of range.
*/ */
getTimelineBarStartOffsetForMonths() { getTimelineBarStartOffsetForMonths(roadmapItem) {
const daysInMonth = totalDaysInMonth(this.timeframeItem); const daysInMonth = totalDaysInMonth(this.timeframeItem);
const startDate = this.epicStartDateValues.date; const startDate = this.startDateValues.date;
if ( if (
this.epic.startDateOutOfRange || roadmapItem.startDateOutOfRange ||
(this.epic.startDateUndefined && this.epic.endDateOutOfRange) (roadmapItem.startDateUndefined && roadmapItem.endDateOutOfRange)
) { ) {
// If Epic startDate is out of timeframe range // If Epic startDate is out of timeframe range
// OR // OR
...@@ -89,8 +89,8 @@ export default { ...@@ -89,8 +89,8 @@ export default {
const indexOfCurrentMonth = this.timeframe.indexOf(this.timeframeItem); const indexOfCurrentMonth = this.timeframe.indexOf(this.timeframeItem);
const { cellWidth } = this.$options; const { cellWidth } = this.$options;
const epicStartDate = this.epicStartDateValues; const itemStartDate = this.startDateValues;
const epicEndDate = this.epicEndDateValues; const itemEndDate = this.endDateValues;
// Start iteration from current month // Start iteration from current month
for (let i = indexOfCurrentMonth; i < this.timeframe.length; i += 1) { for (let i = indexOfCurrentMonth; i < this.timeframe.length; i += 1) {
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
timelineBarWidth += this.getBarWidthForSingleMonth( timelineBarWidth += this.getBarWidthForSingleMonth(
cellWidth, cellWidth,
daysInMonth, daysInMonth,
epicEndDate.date - epicStartDate.date + 1, itemEndDate.date - itemStartDate.date + 1,
); );
// Break as Epic start and end date fall within current timeframe month itself! // Break as Epic start and end date fall within current timeframe month itself!
break; break;
...@@ -115,17 +115,17 @@ export default { ...@@ -115,17 +115,17 @@ export default {
// If start date is first day of the month, // If start date is first day of the month,
// we need width of full cell (i.e. total days of month) // we need width of full cell (i.e. total days of month)
// otherwise, we need width only for date from total days of month. // otherwise, we need width only for date from total days of month.
const date = epicStartDate.date === 1 ? daysInMonth : daysInMonth - epicStartDate.date; const date = itemStartDate.date === 1 ? daysInMonth : daysInMonth - itemStartDate.date;
timelineBarWidth += this.getBarWidthForSingleMonth(cellWidth, daysInMonth, date); timelineBarWidth += this.getBarWidthForSingleMonth(cellWidth, daysInMonth, date);
} }
} else if (this.isTimeframeUnderEndDateForMonth(this.timeframe[i])) { } else if (this.isTimeframeUnderEndDateForMonth(this.timeframe[i])) {
// If this is NOT current month but epicEndDate falls under // If this is NOT current month but itemEndDate falls under
// current timeframe month then calculate width // current timeframe month then calculate width
// based on date of the month // based on date of the month
timelineBarWidth += this.getBarWidthForSingleMonth( timelineBarWidth += this.getBarWidthForSingleMonth(
cellWidth, cellWidth,
daysInMonth, daysInMonth,
epicEndDate.date, itemEndDate.date,
); );
// Break as Epic end date falls within current timeframe month! // Break as Epic end date falls within current timeframe month!
break; break;
......
...@@ -10,8 +10,8 @@ export default { ...@@ -10,8 +10,8 @@ export default {
const quarterEnd = this.timeframeItem.range[2]; const quarterEnd = this.timeframeItem.range[2];
return ( return (
this.epicStartDateValues.time >= quarterStart.getTime() && this.startDateValues.time >= quarterStart.getTime() &&
this.epicStartDateValues.time <= quarterEnd.getTime() this.startDateValues.time <= quarterEnd.getTime()
); );
}, },
/** /**
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
isTimeframeUnderEndDateForQuarter(timeframeItem) { isTimeframeUnderEndDateForQuarter(timeframeItem) {
const quarterEnd = timeframeItem.range[2]; const quarterEnd = timeframeItem.range[2];
return this.epicEndDateValues.time <= quarterEnd.getTime(); return this.endDateValues.time <= quarterEnd.getTime();
}, },
/** /**
* Return timeline bar width for current quarter (timeline cell) based on * Return timeline bar width for current quarter (timeline cell) based on
...@@ -45,13 +45,13 @@ export default { ...@@ -45,13 +45,13 @@ export default {
* Implementation of this method is identical to * Implementation of this method is identical to
* MonthsPresetMixin#getTimelineBarStartOffsetForMonths * MonthsPresetMixin#getTimelineBarStartOffsetForMonths
*/ */
getTimelineBarStartOffsetForQuarters() { getTimelineBarStartOffsetForQuarters(roadmapItem) {
const daysInQuarter = totalDaysInQuarter(this.timeframeItem.range); const daysInQuarter = totalDaysInQuarter(this.timeframeItem.range);
const startDay = dayInQuarter(this.epic.startDate, this.timeframeItem.range); const startDay = dayInQuarter(roadmapItem.startDate, this.timeframeItem.range);
if ( if (
this.epic.startDateOutOfRange || roadmapItem.startDateOutOfRange ||
(this.epic.startDateUndefined && this.epic.endDateOutOfRange) (roadmapItem.startDateUndefined && roadmapItem.endDateOutOfRange)
) { ) {
return ''; return '';
} else if (startDay === 1) { } else if (startDay === 1) {
...@@ -85,13 +85,13 @@ export default { ...@@ -85,13 +85,13 @@ export default {
* Implementation of this method is identical to * Implementation of this method is identical to
* MonthsPresetMixin#getTimelineBarWidthForMonths * MonthsPresetMixin#getTimelineBarWidthForMonths
*/ */
getTimelineBarWidthForQuarters() { getTimelineBarWidthForQuarters(roadmapItem) {
let timelineBarWidth = 0; let timelineBarWidth = 0;
const indexOfCurrentQuarter = this.timeframe.indexOf(this.timeframeItem); const indexOfCurrentQuarter = this.timeframe.indexOf(this.timeframeItem);
const { cellWidth } = this.$options; const { cellWidth } = this.$options;
const epicStartDate = this.epic.startDate; const itemStartDate = roadmapItem.startDate;
const epicEndDate = this.epic.endDate; const itemEndDate = roadmapItem.endDate;
for (let i = indexOfCurrentQuarter; i < this.timeframe.length; i += 1) { for (let i = indexOfCurrentQuarter; i < this.timeframe.length; i += 1) {
const currentQuarter = this.timeframe[i].range; const currentQuarter = this.timeframe[i].range;
...@@ -101,14 +101,14 @@ export default { ...@@ -101,14 +101,14 @@ export default {
timelineBarWidth += this.getBarWidthForSingleQuarter( timelineBarWidth += this.getBarWidthForSingleQuarter(
cellWidth, cellWidth,
totalDaysInQuarter(currentQuarter), totalDaysInQuarter(currentQuarter),
dayInQuarter(epicEndDate, currentQuarter) - dayInQuarter(itemEndDate, currentQuarter) -
dayInQuarter(epicStartDate, currentQuarter) + dayInQuarter(itemStartDate, currentQuarter) +
1, 1,
); );
break; break;
} else { } else {
const daysInQuarter = totalDaysInQuarter(currentQuarter); const daysInQuarter = totalDaysInQuarter(currentQuarter);
const day = dayInQuarter(epicStartDate, currentQuarter); const day = dayInQuarter(itemStartDate, currentQuarter);
const date = day === 1 ? daysInQuarter : daysInQuarter - day; const date = day === 1 ? daysInQuarter : daysInQuarter - day;
timelineBarWidth += this.getBarWidthForSingleQuarter( timelineBarWidth += this.getBarWidthForSingleQuarter(
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
timelineBarWidth += this.getBarWidthForSingleQuarter( timelineBarWidth += this.getBarWidthForSingleQuarter(
cellWidth, cellWidth,
totalDaysInQuarter(currentQuarter), totalDaysInQuarter(currentQuarter),
dayInQuarter(epicEndDate, currentQuarter), dayInQuarter(itemEndDate, currentQuarter),
); );
break; break;
} else { } else {
......
...@@ -11,8 +11,8 @@ export default { ...@@ -11,8 +11,8 @@ export default {
lastDayOfWeek.setDate(lastDayOfWeek.getDate() + 6); lastDayOfWeek.setDate(lastDayOfWeek.getDate() + 6);
return ( return (
this.epicStartDateValues.time >= firstDayOfWeek.getTime() && this.startDateValues.time >= firstDayOfWeek.getTime() &&
this.epicStartDateValues.time <= lastDayOfWeek.getTime() this.startDateValues.time <= lastDayOfWeek.getTime()
); );
}, },
/** /**
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
*/ */
isTimeframeUnderEndDateForWeek(timeframeItem) { isTimeframeUnderEndDateForWeek(timeframeItem) {
const lastDayOfWeek = this.getLastDayOfWeek(timeframeItem); const lastDayOfWeek = this.getLastDayOfWeek(timeframeItem);
return this.epicEndDateValues.time <= lastDayOfWeek.getTime(); return this.endDateValues.time <= lastDayOfWeek.getTime();
}, },
/** /**
* Return timeline bar width for current week (timeline cell) based on * Return timeline bar width for current week (timeline cell) based on
...@@ -53,15 +53,15 @@ export default { ...@@ -53,15 +53,15 @@ export default {
* Implementation of this method is identical to * Implementation of this method is identical to
* MonthsPresetMixin#getTimelineBarStartOffsetForMonths * MonthsPresetMixin#getTimelineBarStartOffsetForMonths
*/ */
getTimelineBarStartOffsetForWeeks() { getTimelineBarStartOffsetForWeeks(roadmapItem) {
const daysInWeek = 7; const daysInWeek = 7;
const dayWidth = this.$options.cellWidth / daysInWeek; const dayWidth = this.$options.cellWidth / daysInWeek;
const startDate = this.epicStartDateValues.day + 1; const startDate = this.startDateValues.day + 1;
const firstDayOfWeek = this.timeframeItem.getDay() + 1; const firstDayOfWeek = this.timeframeItem.getDay() + 1;
if ( if (
this.epic.startDateOutOfRange || roadmapItem.startDateOutOfRange ||
(this.epic.startDateUndefined && this.epic.endDateOutOfRange) (roadmapItem.startDateUndefined && roadmapItem.endDateOutOfRange)
) { ) {
return ''; return '';
} else if (startDate === firstDayOfWeek) { } else if (startDate === firstDayOfWeek) {
...@@ -99,23 +99,23 @@ export default { ...@@ -99,23 +99,23 @@ export default {
const indexOfCurrentWeek = this.timeframe.indexOf(this.timeframeItem); const indexOfCurrentWeek = this.timeframe.indexOf(this.timeframeItem);
const { cellWidth } = this.$options; const { cellWidth } = this.$options;
const epicStartDate = this.epicStartDateValues; const itemStartDate = this.startDateValues;
const epicEndDate = this.epicEndDateValues; const itemEndDate = this.endDateValues;
for (let i = indexOfCurrentWeek; i < this.timeframe.length; i += 1) { for (let i = indexOfCurrentWeek; i < this.timeframe.length; i += 1) {
if (i === indexOfCurrentWeek) { if (i === indexOfCurrentWeek) {
if (this.isTimeframeUnderEndDateForWeek(this.timeframe[i])) { if (this.isTimeframeUnderEndDateForWeek(this.timeframe[i])) {
timelineBarWidth += this.getBarWidthForSingleWeek( timelineBarWidth += this.getBarWidthForSingleWeek(
cellWidth, cellWidth,
epicEndDate.day - epicStartDate.day + 1, itemEndDate.day - itemStartDate.day + 1,
); );
break; break;
} else { } else {
const date = epicStartDate.day === 0 ? 7 : 7 - epicStartDate.day; const date = itemStartDate.day === 0 ? 7 : 7 - itemStartDate.day;
timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, date); timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, date);
} }
} else if (this.isTimeframeUnderEndDateForWeek(this.timeframe[i])) { } else if (this.isTimeframeUnderEndDateForWeek(this.timeframe[i])) {
timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, epicEndDate.day + 1); timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, itemEndDate.day + 1);
break; break;
} else { } else {
timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, 7); timelineBarWidth += this.getBarWidthForSingleWeek(cellWidth, 7);
......
...@@ -38,9 +38,9 @@ describe('EpicItemTimelineComponent', () => { ...@@ -38,9 +38,9 @@ describe('EpicItemTimelineComponent', () => {
vm = createComponent({}); vm = createComponent({});
}); });
describe('epicStartDateValues', () => { describe('startDateValues', () => {
it('returns object containing date parts from epic.startDate', () => { it('returns object containing date parts from epic.startDate', () => {
expect(vm.epicStartDateValues).toEqual( expect(vm.startDateValues).toEqual(
jasmine.objectContaining({ jasmine.objectContaining({
day: mockEpic.startDate.getDay(), day: mockEpic.startDate.getDay(),
date: mockEpic.startDate.getDate(), date: mockEpic.startDate.getDate(),
...@@ -52,9 +52,9 @@ describe('EpicItemTimelineComponent', () => { ...@@ -52,9 +52,9 @@ describe('EpicItemTimelineComponent', () => {
}); });
}); });
describe('epicEndDateValues', () => { describe('endDateValues', () => {
it('returns object containing date parts from epic.endDate', () => { it('returns object containing date parts from epic.endDate', () => {
expect(vm.epicEndDateValues).toEqual( expect(vm.endDateValues).toEqual(
jasmine.objectContaining({ jasmine.objectContaining({
day: mockEpic.endDate.getDay(), day: mockEpic.endDate.getDay(),
date: mockEpic.endDate.getDate(), date: mockEpic.endDate.getDate(),
......
...@@ -102,7 +102,7 @@ describe('MonthsPresetMixin', () => { ...@@ -102,7 +102,7 @@ describe('MonthsPresetMixin', () => {
epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }), epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }),
}); });
expect(vm.getTimelineBarStartOffsetForMonths()).toBe(''); expect(vm.getTimelineBarStartOffsetForMonths(vm.epic)).toBe('');
}); });
it('returns empty string when Epic startDate is undefined and endDate is out of range', () => { it('returns empty string when Epic startDate is undefined and endDate is out of range', () => {
...@@ -113,7 +113,7 @@ describe('MonthsPresetMixin', () => { ...@@ -113,7 +113,7 @@ describe('MonthsPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForMonths()).toBe(''); expect(vm.getTimelineBarStartOffsetForMonths(vm.epic)).toBe('');
}); });
it('return `left: 0;` when Epic startDate is first day of the month', () => { it('return `left: 0;` when Epic startDate is first day of the month', () => {
...@@ -123,7 +123,7 @@ describe('MonthsPresetMixin', () => { ...@@ -123,7 +123,7 @@ describe('MonthsPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForMonths()).toBe('left: 0;'); expect(vm.getTimelineBarStartOffsetForMonths(vm.epic)).toBe('left: 0;');
}); });
it('returns proportional `left` value based on Epic startDate and days in the month', () => { it('returns proportional `left` value based on Epic startDate and days in the month', () => {
...@@ -133,7 +133,7 @@ describe('MonthsPresetMixin', () => { ...@@ -133,7 +133,7 @@ describe('MonthsPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForMonths()).toContain('left: 50%'); expect(vm.getTimelineBarStartOffsetForMonths(vm.epic)).toContain('left: 50%');
}); });
}); });
......
...@@ -102,7 +102,7 @@ describe('QuartersPresetMixin', () => { ...@@ -102,7 +102,7 @@ describe('QuartersPresetMixin', () => {
epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }), epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }),
}); });
expect(vm.getTimelineBarStartOffsetForQuarters()).toBe(''); expect(vm.getTimelineBarStartOffsetForQuarters(vm.epic)).toBe('');
}); });
it('returns empty string when Epic startDate is undefined and endDate is out of range', () => { it('returns empty string when Epic startDate is undefined and endDate is out of range', () => {
...@@ -113,7 +113,7 @@ describe('QuartersPresetMixin', () => { ...@@ -113,7 +113,7 @@ describe('QuartersPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForQuarters()).toBe(''); expect(vm.getTimelineBarStartOffsetForQuarters(vm.epic)).toBe('');
}); });
it('return `left: 0;` when Epic startDate is first day of the quarter', () => { it('return `left: 0;` when Epic startDate is first day of the quarter', () => {
...@@ -123,7 +123,7 @@ describe('QuartersPresetMixin', () => { ...@@ -123,7 +123,7 @@ describe('QuartersPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForQuarters()).toBe('left: 0;'); expect(vm.getTimelineBarStartOffsetForQuarters(vm.epic)).toBe('left: 0;');
}); });
it('returns proportional `left` value based on Epic startDate and days in the quarter', () => { it('returns proportional `left` value based on Epic startDate and days in the quarter', () => {
...@@ -133,7 +133,7 @@ describe('QuartersPresetMixin', () => { ...@@ -133,7 +133,7 @@ describe('QuartersPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForQuarters()).toContain('left: 34'); expect(vm.getTimelineBarStartOffsetForQuarters(vm.epic)).toContain('left: 34');
}); });
}); });
...@@ -147,7 +147,7 @@ describe('QuartersPresetMixin', () => { ...@@ -147,7 +147,7 @@ describe('QuartersPresetMixin', () => {
}), }),
}); });
expect(Math.floor(vm.getTimelineBarWidthForQuarters())).toBe(180); expect(Math.floor(vm.getTimelineBarWidthForQuarters(vm.epic))).toBe(180);
}); });
}); });
}); });
......
...@@ -113,7 +113,7 @@ describe('WeeksPresetMixin', () => { ...@@ -113,7 +113,7 @@ describe('WeeksPresetMixin', () => {
epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }), epic: Object.assign({}, mockEpic, { startDateOutOfRange: true }),
}); });
expect(vm.getTimelineBarStartOffsetForWeeks()).toBe(''); expect(vm.getTimelineBarStartOffsetForWeeks(vm.epic)).toBe('');
}); });
it('returns empty string when Epic startDate is undefined and endDate is out of range', () => { it('returns empty string when Epic startDate is undefined and endDate is out of range', () => {
...@@ -124,7 +124,7 @@ describe('WeeksPresetMixin', () => { ...@@ -124,7 +124,7 @@ describe('WeeksPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForWeeks()).toBe(''); expect(vm.getTimelineBarStartOffsetForWeeks(vm.epic)).toBe('');
}); });
it('return `left: 0;` when Epic startDate is first day of the week', () => { it('return `left: 0;` when Epic startDate is first day of the week', () => {
...@@ -134,17 +134,17 @@ describe('WeeksPresetMixin', () => { ...@@ -134,17 +134,17 @@ describe('WeeksPresetMixin', () => {
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForWeeks()).toBe('left: 0;'); expect(vm.getTimelineBarStartOffsetForWeeks(vm.epic)).toBe('left: 0;');
}); });
it('returns proportional `left` value based on Epic startDate and days in the month', () => { it('returns proportional `left` value based on Epic startDate and days in the week', () => {
vm = createComponent({ vm = createComponent({
epic: Object.assign({}, mockEpic, { epic: Object.assign({}, mockEpic, {
startDate: new Date(2018, 0, 15), startDate: new Date(2018, 0, 15),
}), }),
}); });
expect(vm.getTimelineBarStartOffsetForWeeks()).toContain('left: 38'); expect(vm.getTimelineBarStartOffsetForWeeks(vm.epic)).toContain('left: 38');
}); });
}); });
......
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