Closed MWhiteFearless closed 1 year ago
Hi @MWhiteFearless,
Thank you for your complete bug report. I will look into this when possible.
Beat, David
Hi @MWhiteFearless,
I haven't investigated this fully but I can think of three things that have changed internally in Embla from v7 --> v8 that can potentially cause problems with React Testing Library:
window.matchMedia
in v8.ResizeObserver
in v8.MutationObserver
in v8.IntersectionObserver
in v8.So let's say you mock window.matchMedia
like this. If you run the tests after that and it starts to work or you get a different error, then I'm probably right about my guess.
Best, David
It works by mocking matchMedia! Tests are passing now, thank you! The stackoverflow suggestion worked perfectly for me.
@MWhiteFearless I'm glad it solved the problem. So I'm closing this issue then?
Best, David
Yeah works for me! It could be nice to add a note to the documentation in case others run in to this issue. Really appreciate your help!
@MWhiteFearless thanks for the suggestion. I will add it to the breaking changes section in the release notes for the stable v8 release which is coming soon.
@raphaelApard see my comment.
Thanks a lot @MWhiteFearless for completing this issue and @davidjerleke for your responsiveness ! And by the way, thanks for the great work you do with embla-carousel.
Bug is related to
Embla Carousel version
Describe the bug
When upgrading from
embla-carousel-react
v6.2.0 to v8.0.0-rc7, the tests in my repo for components using embla-carousel-react started failing with the errorTypeError: undefined is not a function at Array.map (<anonymous>)
when callingrender()
from react testing libraryCodeSandbox
- The link to a CodeSandbox that demonstrates the bug clearly.
Steps to reproduce
renders EmblaCarousel
test fails with the errorTypeError: undefined is not a function at Array.map ()