Skip to content

Commit

Permalink
fix bug with more+ link, async event sources. closes #4585
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Apr 23, 2019
1 parent 4e1fc5a commit 01af779
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/daygrid/DayGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export default class DayGrid extends DateComponent<DayGridProps> {
moreLink = this.renderMoreLink(row, col, segsBelow)
moreWrap = createElement('div', null, moreLink)
td.appendChild(moreWrap)
moreNodes.push(moreWrap[0])
moreNodes.push(moreWrap)
}
col++
}
Expand Down
47 changes: 47 additions & 0 deletions tests/automated/event-source/async-eventLimit.js
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)
}

0 comments on commit 01af779

Please sign in to comment.