Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cc507542
Commit
cc507542
authored
Feb 24, 2020
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor roadmap mixins
Refactor roadmap mixins to prepare adding milestones to roadmap
parent
e50a6361
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
64 deletions
+70
-64
ee/app/assets/javascripts/roadmap/components/epic_item_timeline.vue
...ets/javascripts/roadmap/components/epic_item_timeline.vue
+11
-5
ee/app/assets/javascripts/roadmap/mixins/months_preset_mixin.js
.../assets/javascripts/roadmap/mixins/months_preset_mixin.js
+15
-15
ee/app/assets/javascripts/roadmap/mixins/quarters_preset_mixin.js
...ssets/javascripts/roadmap/mixins/quarters_preset_mixin.js
+14
-14
ee/app/assets/javascripts/roadmap/mixins/weeks_preset_mixin.js
...p/assets/javascripts/roadmap/mixins/weeks_preset_mixin.js
+12
-12
ee/spec/javascripts/roadmap/components/epic_item_timeline_spec.js
...javascripts/roadmap/components/epic_item_timeline_spec.js
+4
-4
ee/spec/javascripts/roadmap/mixins/months_preset_mixin_spec.js
...ec/javascripts/roadmap/mixins/months_preset_mixin_spec.js
+4
-4
ee/spec/javascripts/roadmap/mixins/quarters_preset_mixin_spec.js
.../javascripts/roadmap/mixins/quarters_preset_mixin_spec.js
+5
-5
ee/spec/javascripts/roadmap/mixins/weeks_preset_mixin_spec.js
...pec/javascripts/roadmap/mixins/weeks_preset_mixin_spec.js
+5
-5
No files found.
ee/app/assets/javascripts/roadmap/components/epic_item_timeline.vue
View file @
cc507542
...
@@ -38,7 +38,7 @@ export default {
...
@@ -38,7 +38,7 @@ export default {
},
},
},
},
computed
:
{
computed
:
{
epicS
tartDateValues
()
{
s
tartDateValues
()
{
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
(),
};
};
},
},
e
picE
ndDateValues
()
{
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
;
...
...
ee/app/assets/javascripts/roadmap/mixins/months_preset_mixin.js
View file @
cc507542
...
@@ -7,18 +7,18 @@ export default {
...
@@ -7,18 +7,18 @@ export default {
*/
*/
hasStartDateForMonth
()
{
hasStartDateForMonth
()
{
return
(
return
(
this
.
epicS
tartDateValues
.
month
===
this
.
timeframeItem
.
getMonth
()
&&
this
.
s
tartDateValues
.
month
===
this
.
timeframeItem
.
getMonth
()
&&
this
.
epicS
tartDateValues
.
year
===
this
.
timeframeItem
.
getFullYear
()
this
.
s
tartDateValues
.
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
.
e
picE
ndDateValues
.
year
<=
timeframeItem
.
getFullYear
())
{
if
(
this
.
endDateValues
.
year
<=
timeframeItem
.
getFullYear
())
{
return
this
.
e
picE
ndDateValues
.
month
===
timeframeItem
.
getMonth
();
return
this
.
endDateValues
.
month
===
timeframeItem
.
getMonth
();
}
}
return
this
.
e
picE
ndDateValues
.
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
.
epicS
tartDateValues
.
date
;
const
startDate
=
this
.
s
tartDateValues
.
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
.
epicS
tartDateValues
;
const
itemStartDate
=
this
.
s
tartDateValues
;
const
epicEndDate
=
this
.
epicE
ndDateValues
;
const
itemEndDate
=
this
.
e
ndDateValues
;
// 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
-
epic
StartDate
.
date
+
1
,
itemEndDate
.
date
-
item
StartDate
.
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
-
epic
StartDate
.
date
;
const
date
=
itemStartDate
.
date
===
1
?
daysInMonth
:
daysInMonth
-
item
StartDate
.
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
epic
EndDate falls under
// If this is NOT current month but
item
EndDate 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
,
epic
EndDate
.
date
,
item
EndDate
.
date
,
);
);
// Break as Epic end date falls within current timeframe month!
// Break as Epic end date falls within current timeframe month!
break
;
break
;
...
...
ee/app/assets/javascripts/roadmap/mixins/quarters_preset_mixin.js
View file @
cc507542
...
@@ -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
.
epicS
tartDateValues
.
time
>=
quarterStart
.
getTime
()
&&
this
.
s
tartDateValues
.
time
>=
quarterStart
.
getTime
()
&&
this
.
epicS
tartDateValues
.
time
<=
quarterEnd
.
getTime
()
this
.
s
tartDateValues
.
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
.
e
picE
ndDateValues
.
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
(
epic
EndDate
,
currentQuarter
)
-
dayInQuarter
(
item
EndDate
,
currentQuarter
)
-
dayInQuarter
(
epic
StartDate
,
currentQuarter
)
+
dayInQuarter
(
item
StartDate
,
currentQuarter
)
+
1
,
1
,
);
);
break
;
break
;
}
else
{
}
else
{
const
daysInQuarter
=
totalDaysInQuarter
(
currentQuarter
);
const
daysInQuarter
=
totalDaysInQuarter
(
currentQuarter
);
const
day
=
dayInQuarter
(
epic
StartDate
,
currentQuarter
);
const
day
=
dayInQuarter
(
item
StartDate
,
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
(
epic
EndDate
,
currentQuarter
),
dayInQuarter
(
item
EndDate
,
currentQuarter
),
);
);
break
;
break
;
}
else
{
}
else
{
...
...
ee/app/assets/javascripts/roadmap/mixins/weeks_preset_mixin.js
View file @
cc507542
...
@@ -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
.
epicS
tartDateValues
.
time
>=
firstDayOfWeek
.
getTime
()
&&
this
.
s
tartDateValues
.
time
>=
firstDayOfWeek
.
getTime
()
&&
this
.
epicS
tartDateValues
.
time
<=
lastDayOfWeek
.
getTime
()
this
.
s
tartDateValues
.
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
.
e
picE
ndDateValues
.
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
.
epicS
tartDateValues
.
day
+
1
;
const
startDate
=
this
.
s
tartDateValues
.
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
.
epicS
tartDateValues
;
const
itemStartDate
=
this
.
s
tartDateValues
;
const
epicEndDate
=
this
.
epicE
ndDateValues
;
const
itemEndDate
=
this
.
e
ndDateValues
;
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
-
epic
StartDate
.
day
+
1
,
itemEndDate
.
day
-
item
StartDate
.
day
+
1
,
);
);
break
;
break
;
}
else
{
}
else
{
const
date
=
epicStartDate
.
day
===
0
?
7
:
7
-
epic
StartDate
.
day
;
const
date
=
itemStartDate
.
day
===
0
?
7
:
7
-
item
StartDate
.
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
,
epic
EndDate
.
day
+
1
);
timelineBarWidth
+=
this
.
getBarWidthForSingleWeek
(
cellWidth
,
item
EndDate
.
day
+
1
);
break
;
break
;
}
else
{
}
else
{
timelineBarWidth
+=
this
.
getBarWidthForSingleWeek
(
cellWidth
,
7
);
timelineBarWidth
+=
this
.
getBarWidthForSingleWeek
(
cellWidth
,
7
);
...
...
ee/spec/javascripts/roadmap/components/epic_item_timeline_spec.js
View file @
cc507542
...
@@ -38,9 +38,9 @@ describe('EpicItemTimelineComponent', () => {
...
@@ -38,9 +38,9 @@ describe('EpicItemTimelineComponent', () => {
vm
=
createComponent
({});
vm
=
createComponent
({});
});
});
describe
(
'
epicS
tartDateValues
'
,
()
=>
{
describe
(
'
s
tartDateValues
'
,
()
=>
{
it
(
'
returns object containing date parts from epic.startDate
'
,
()
=>
{
it
(
'
returns object containing date parts from epic.startDate
'
,
()
=>
{
expect
(
vm
.
epicS
tartDateValues
).
toEqual
(
expect
(
vm
.
s
tartDateValues
).
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
(
'
e
picE
ndDateValues
'
,
()
=>
{
describe
(
'
endDateValues
'
,
()
=>
{
it
(
'
returns object containing date parts from epic.endDate
'
,
()
=>
{
it
(
'
returns object containing date parts from epic.endDate
'
,
()
=>
{
expect
(
vm
.
e
picE
ndDateValues
).
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
(),
...
...
ee/spec/javascripts/roadmap/mixins/months_preset_mixin_spec.js
View file @
cc507542
...
@@ -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%
'
);
});
});
});
});
...
...
ee/spec/javascripts/roadmap/mixins/quarters_preset_mixin_spec.js
View file @
cc507542
...
@@ -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
);
});
});
});
});
});
});
...
...
ee/spec/javascripts/roadmap/mixins/weeks_preset_mixin_spec.js
View file @
cc507542
...
@@ -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
'
);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment