fullcalendar: Unable to see events rendered in tests

Reduced Test Case

  1. Clone the repo https://github.com/tgandrews/fullcalendar-test
  2. yarn
  3. yarn start see the events rendered
  4. yarn test see the tests pass but the snapshot include no events in src/__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)

Most upvoted comments

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 eventContent prop set as function and validated that it haven’t called. On the other hand viewClassNames were triggered and view.calendar.getEvents() return correct events with correct dates. Debug output obviously displays plain Fullcalendar html layout without events

this 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.