Skip to content

Commit 1957b04

Browse files
paul-russoalexkrolick
authored andcommitted
Clarify testIdAttribute (#330)
I was a bit confused while reading through these docs as to whether or not the value I supplied to `testIdAttribute` would be prefixed with `data-`. It turns out that the value is _not_ prefixed, and so `my-data-test-id` wouldn't be a valid `data-` attribute. This change replaces the current example `my-data-test-id` with `data-my-test-id`.
1 parent 9d697ad commit 1957b04

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/dom-testing-library/api-configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ and related queries. Defaults to `data-testid`.
2929
// setup-tests.js
3030
import { configure } from '@testing-library/dom'
3131

32-
configure({testIdAttribute: 'my-data-test-id'})
32+
configure({testIdAttribute: 'data-my-test-id'})
3333
```
3434

3535
<!--React-->
@@ -38,7 +38,7 @@ configure({testIdAttribute: 'my-data-test-id'})
3838
// setup-tests.js
3939
import { configure } from '@testing-library/react'
4040

41-
configure({testIdAttribute: 'my-data-test-id'})
41+
configure({testIdAttribute: 'data-my-test-id'})
4242
```
4343

4444
<!--Cypress-->
@@ -47,7 +47,7 @@ configure({testIdAttribute: 'my-data-test-id'})
4747
// setup-tests.js
4848
import { configure } from '@testing-library/cypress'
4949

50-
configure({testIdAttribute: 'my-data-test-id'})
50+
configure({testIdAttribute: 'data-my-test-id'})
5151
```
5252

5353
<!--END_DOCUSAURUS_CODE_TABS-->

0 commit comments

Comments
 (0)