Skip to content

Commit b82b7e6

Browse files
authored
Merge pull request #3306 from SebastianEShelby/patch-4
Update part5c.md: improve note about data attributes and selectors
2 parents 507a9a5 + 88a0f37 commit b82b7e6

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 a specified _data-testid_ attribute.
190190

191191
### Debugging tests
192192

0 commit comments

Comments
 (0)