-
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.
always refetch when a date nav invalidates an in-progress event sourc…
…e fetch
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 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,45 @@ | ||
|
||
describe('event fetching while date-navigating', function() { | ||
|
||
// https://github.com/fullcalendar/fullcalendar/issues/4975 | ||
it('renders events when doing next() and then prev()', function(done) { | ||
|
||
initCalendar({ | ||
defaultView: 'dayGridMonth', | ||
defaultDate: '2020-02-11', | ||
events: function(arg, callback) { | ||
if (arg.startStr.indexOf('2020-01-26') === 0) { // for Feb | ||
setTimeout(function() { | ||
callback([ | ||
{ start: '2020-02-15' } // middle of month | ||
]) | ||
}, 100) | ||
} else if (arg.startStr.indexOf('2020-03-01') === 0) { // for March | ||
setTimeout(function() { | ||
callback([ | ||
{ start: '2020-03-15' } // middle of month | ||
]) | ||
}, 100) | ||
} else { | ||
throw new Error('bad range') | ||
} | ||
} | ||
}) | ||
|
||
setTimeout(function() { | ||
|
||
currentCalendar.next() | ||
setTimeout(function() { | ||
|
||
currentCalendar.prev() | ||
setTimeout(function() { | ||
|
||
expect($('.fc-event').length).toBe(1) | ||
done() | ||
|
||
}, 1000) // after everything | ||
}, 50) // before second fetch finishes | ||
}, 200) // let first fetch finish | ||
}) | ||
|
||
}) |
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