birdofpreyru/react-utils

Add `data-testid` prop to control components

Opened this issue · 4 comments

Button, Input, etc. should pass it to their underlying control elements to facilitate their look-up in DOM by react-dom testing library.

Added to Button, Dropdown, Modal components. More to come.

Also... update to avoid any test ids being used in production builds.
i.e. use inline process.env.NODE_ENV !== 'production' check, so that Webpack can completely optimize it out of production code.

These are done now:
- Add testId to Checkbox!
- Add testIdForOverlay to Modal!

TextArea needs it!