-
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 more+ link, async event sources. closes #4585
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
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
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,47 @@ | ||
|
||
// https://github.com/fullcalendar/fullcalendar/issues/4585 | ||
// more related to the 'more+' link than to async event sources | ||
it('rerendering works with async sources and eventLimit', function(done) { | ||
let cnt = 0 | ||
|
||
initCalendar({ | ||
defaultView: 'dayGridMonth', | ||
eventLimit: 2, | ||
header: { | ||
left: 'prev,next today', | ||
center: 'title', | ||
right: 'timeGridWeek,dayGridMonth' | ||
}, | ||
eventSources: [ | ||
getEvents, | ||
getEvents | ||
], | ||
_eventsPositioned() { // why can't use spyOnCalendarCallback :( | ||
cnt++ | ||
if (cnt === 1) { | ||
currentCalendar.next() | ||
setTimeout(done, 1) // after the async fetch | ||
} | ||
} | ||
}) | ||
}) | ||
|
||
function getEvents(fetchInfo, success) { | ||
let date = fetchInfo.start | ||
let events = [] | ||
|
||
while (date.getTime() < fetchInfo.end.getTime()) { | ||
events.push({ | ||
title: 'Event ' + date.getDate(), | ||
start: date, | ||
end: new Date(date.getTime() + 1000 * 60 * 60 * 60), | ||
allDay: false | ||
}) | ||
|
||
date = new Date(date.getTime() + 1000 * 60 * 60 * 24) | ||
} | ||
|
||
setTimeout(function() { | ||
success(events) | ||
}, 0) | ||
} |