markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 100 forks source link

replace enzyme with testing-library #112

Closed smhg closed 2 years ago

smhg commented 2 years ago

(copy of PR testing-library/dom-testing-library#111 but from a proper branch - sorry about the distraction)

@markusenglund I've created this PR to pave the way for React 18 compatibility (see https://github.com/markusenglund/react-switch/issues/107). (sadly) Enzyme doesn't seem to have a future, so tests had to be refactored with testing-library.

This seems to work quite well, except for the snapshots. Can you please have a look why they are different? It seems to be a matter of spacing and, more importantly, vendor-prefixing in style declarations. Do you have any idea what generated those vendor-prefixes in the snapshots?

erdilalbayrak commented 2 years ago

Is there a way to promote this change?

markusenglund commented 2 years ago

Hey, thanks for the PR. It looks to me like react-testing-library is removing the vendor-prefixed css properties for some reason. Not sure why. For now I'll merge this with the tests failing and figure it out later.

markusenglund commented 2 years ago

Created an issue for the failing tests: https://github.com/testing-library/react-testing-library/issues/1085