@@ -44,7 +44,7 @@ components. It provides light utility functions on top of `react-dom` and
44
44
* [ ` Simulate ` ] ( #simulate )
45
45
* [ ` flushPromises ` ] ( #flushpromises )
46
46
* [ ` render ` ] ( #render )
47
- * [ More on ` data-test ` ids ] ( #more-on-data-test-ids )
47
+ * [ More on ` data-testid ` s ] ( #more-on-data-testids )
48
48
* [ FAQ] ( #faq )
49
49
* [ Other Solutions] ( #other-solutions )
50
50
* [ Guiding Principles] ( #guiding-principles )
@@ -128,16 +128,16 @@ The containing DOM node of your rendered React Element (rendered using
128
128
129
129
#### ` queryByTestId `
130
130
131
- A shortcut to `` container.querySelector(`[data-test ="${yourId}"]`) `` . Read
132
- more about data-test ids below.
131
+ A shortcut to `` container.querySelector(`[data-testid ="${yourId}"]`) `` . Read
132
+ more about ` data-testid ` s below.
133
133
134
134
``` javascript
135
135
const usernameInputElement = queryByTestId (' username-input' )
136
136
```
137
137
138
- ## More on ` data-test ` ids
138
+ ## More on ` data-testid ` s
139
139
140
- The ` queryByTestId ` utility is referring to the practice of using ` data-test `
140
+ The ` queryByTestId ` utility is referring to the practice of using ` data-testid `
141
141
attributes to identify individual elements in your rendered component. This is
142
142
one of the practices this library is intended to encourage.
143
143
@@ -216,18 +216,18 @@ something more
216
216
Learn more about how Jest mocks work from my blog post:
217
217
[ "But really, what is a JavaScript mock?"] ( https://blog.kentcdodds.com/but-really-what-is-a-javascript-mock-10d060966f7d )
218
218
219
- ** I don't want to use ` data-test ` attributes for everything. Do I have to?**
219
+ ** I don't want to use ` data-testid ` attributes for everything. Do I have to?**
220
220
221
- Definitely not. That said, a common reason people don't like the ` data-test `
221
+ Definitely not. That said, a common reason people don't like the ` data-testid `
222
222
attribute is they're concerned about shipping that to production. I'd suggest
223
223
that you probably want some simple E2E tests that run in production on occasion
224
- to make certain that things are working smoothly. In that case the ` data-test `
224
+ to make certain that things are working smoothly. In that case the ` data-testid `
225
225
attributes will be very useful. Even if you don't run these in production, you
226
226
may want to run some E2E tests that run on the same code you're about to ship to
227
- production. In that case, the ` data-test ` attributes will be valuable there as
227
+ production. In that case, the ` data-testid ` attributes will be valuable there as
228
228
well.
229
229
230
- All that said, if you really don't want to ship ` data-test ` attributes, then you
230
+ All that said, if you really don't want to ship ` data-testid ` attributes, then you
231
231
can use
232
232
[ this simple babel plugin] ( https://www.npmjs.com/package/babel-plugin-react-remove-properties )
233
233
to remove them.
0 commit comments