thumbtack / thumbprint

Thumbprint is the design system at Thumbtack.
https://thumbprint.design
Apache License 2.0
201 stars 27 forks source link

Change usage of `data-test` attribute to `data-testid` #724

Open danoc opened 4 years ago

danoc commented 4 years ago

We should also rename the prop dataTest to dataTestId in the process.

I propose that we do this in a few steps:

  1. Add temporary support for both props and attributes.
  2. Either find and replace to perform the migration or create a codemod: https://github.com/thumbtack/thumbprint/tree/master/packages/thumbprint-codemods (We can likely borrow a lot from the other codemods.)
  3. Once the migration in website is complete, remove the deprecated prop. Release as a breaking change.
mattybow commented 3 years ago

We might not need to adjust the dataTest attribute https://testing-library.com/docs/dom-testing-library/api-helpers#custom-queries

For example, the code below shows a way to override the default testId queries to use a different data-attribute

https://testing-library.com/docs/react-testing-library/api#queries