Skip to content

Commit

Permalink
Add tests for issue jquense#899
Browse files Browse the repository at this point in the history
  • Loading branch information
Brice Gelineau committed Jul 25, 2018
1 parent 01d4515 commit 05829b3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/utils/DayEventLayout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ describe('getStyledEvents', () => {
describe('matrix', () => {
function compare(title, events, expectedResults) {
it(title, () => {
events.forEach((event, index) => (event.id = index))
const styledEvents = getStyledEvents({
events,
startAccessor: 'start',
endAccessor: 'end',
slotMetrics,
minimumStartDifference: 10,
})
styledEvents.sort((a, b) => a.event.id - b.event.id)
const results = styledEvents.map(result => ({
width: Math.floor(result.style.width),
xOffset: Math.floor(result.style.xOffset),
Expand Down Expand Up @@ -89,6 +91,23 @@ describe('getStyledEvents', () => {
{ width: 33, xOffset: 66 },
],
],
[
'complex events spanning multiple containers',
[
{ start: d(8, 15), end: d(13, 15) },
{ start: d(8, 45), end: d(14) },
{ start: d(10, 45), end: d(17) },
{ start: d(14), end: d(20) },
{ start: d(15, 30), end: d(20, 30) },
],
[
{ width: 56, xOffset: 0 },
{ width: 56, xOffset: 33 },
{ width: 33, xOffset: 66 },
{ width: 85, xOffset: 0 },
{ width: 50, xOffset: 50 },
],
],
]
toCheck.forEach(args => compare(...args))
})
Expand Down

0 comments on commit 05829b3

Please sign in to comment.