-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug with daygrid event positioning
- Loading branch information
Showing
3 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { DayGridViewWrapper } from '../lib/wrappers/DayGridViewWrapper' | ||
import { rectsIntersect } from '../lib/geom' | ||
|
||
|
||
describe('dayGrid advanced event rendering', function() { | ||
|
||
// https://github.com/fullcalendar/fullcalendar/issues/5408 | ||
it('renders without intersecting', function() { | ||
let calendar = initCalendar({ | ||
initialView: 'dayGridMonth', | ||
initialDate: '2020-05-01', | ||
events: [ | ||
{ start: '2020-05-02', end: '2020-05-04', title: 'event a' }, | ||
{ start: '2020-05-02', end: '2020-05-04', title: 'event b' }, | ||
{ start: '2020-05-03', end: '2020-05-05', title: 'event c' }, | ||
{ start: '2020-05-04', title: 'event d' }, | ||
{ start: '2020-05-04', title: 'event e' } | ||
] | ||
}) | ||
|
||
let viewWrapper = new DayGridViewWrapper(calendar) | ||
let eventEls = viewWrapper.dayGrid.getEventEls() | ||
let rects = eventEls.map((el) => el.getBoundingClientRect()) | ||
let intersects = false | ||
|
||
for (let i = 0; i < rects.length; i++) { | ||
for (let j = i + 1; j < rects.length; j++) { | ||
if (rectsIntersect(rects[i], rects[j])) { | ||
console.log('rect intersection', eventEls[i], eventEls[j]) | ||
intersects = true | ||
} | ||
} | ||
} | ||
|
||
expect(intersects).toBe(false) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters