fullcalendar: Unable to see events rendered in tests
Reduced Test Case
- Clone the repo https://github.com/tgandrews/fullcalendar-test
yarnyarn startsee the events renderedyarn testsee the tests pass but the snapshot include no events insrc/__snapshots__/App.test.js.snap
Bug Description
Describe how to recreate the bug. Follow the steps above to be able to recreate. This works with v4 providing that is used instead.
What do you expect to happen? I expect events to be rendered in test environments
What happens instead? No events are rendered in tests even after waiting for a long time 20seconds in the linked example
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 18 (8 by maintainers)
I believe I’ve found where rendering is short-circuiting when no available coordinates:
The next step is to modify the code so events are rendered unconditionally, even without coordinates, which may required a tiny bit of refactoring.
Have very similar issue. Have Fullcalendar(v5) rendered as React component. Tests configured with jest and testing-library I have
eventContentprop set as function and validated that it haven’t called. On the other handviewClassNameswere triggered andview.calendar.getEvents()return correct events with correct dates. Debug output obviously displays plain Fullcalendar html layout without eventsthis has been implemented and queued for release.
this fix has been released in v5.8.0
Thanks for the details, I wasn’t able to get it to run in my browser though as you mentioned it seems that system is not very reliable.
Although I had a look at your test and it seems to be looking for the event element immediately after the calendar is rendered, it should work if you add a delay (eg. setTimeout) to give time for the events to render.