plotly / dash-daq

Control components for Dash
MIT License
141 stars 40 forks source link

Update to React 16 #58

Closed shammamah-zz closed 5 years ago

shammamah-zz commented 5 years ago

Closes #57

About

The dash-daq library is still using an old version of React (15.x.x). Dash versions 1.0.0 and higher are incompatible with versions of React that come before 16.0.0.

After updating the React requirements, I also updated the version of enzyme from 2.x to 3.x, using this guide provided by the authors of that package: https://airbnb.io/enzyme/docs/guides/migration-from-2-to-3.html

I also ran into an issue with find() in the tests returning an object and not the actual data, which are needed for calculations of length. I implemented the fix suggested here https://github.com/airbnb/enzyme/issues/1393 by adding hostnodes() after the call to find().

In the test for displays updates with correct value, setState was actually not being called on the mounted component. I changed the test to use a similar pattern as described in https://github.com/airbnb/enzyme/issues/1794#issuecomment-508007334 (this is a known issue with Enzyme, and further discussion can be found in that thread).