Skip to content

Commit 24ccb97

Browse files
Update part5c.md: improve note about data attributes and selectors
Update part5c.md: improve note about "data attributes" and "selectors" with a more clear language and additional links.
1 parent 1e7548b commit 24ccb97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/5/en/part5c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ test('renders content', () => {
186186
})
187187
```
188188

189-
**NB:** A better method of selecting elements for testing, is setting id-attributes that are inserted into the code specifically for testing purposes. We can then use a selector like [getByTestId](https://testing-library.com/docs/queries/bytestid/), that looks for elements based on the specified id-attribute (named `data-testid` in this case).
189+
**NB:** A more consistent way of selecting elements is using a [data attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*) that is specifically defined for testing purposes. Using _react-testing-library_, we can leverage the [getByTestId](https://testing-library.com/docs/queries/bytestid/) method to select elements with their specified _data-testid_ attribute.
190190

191191
### Debugging tests
192192

0 commit comments

Comments
 (0)