Skip to content

Commit 1f971a4

Browse files
bjohn465Kent C. Dodds
authored and
Kent C. Dodds
committed
Fix getByAltText examples (#117)
* Fix `getByAltText` examples Fixes #116 * Use regular expression for `getByAltText` example
1 parent 4a8bd9d commit 1f971a4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ as it's deprecated).
308308
import { getByAltText } from 'dom-testing-library'
309309

310310
const container = document.body
311-
const incrediblesPosterImg = getByAltText(container, /incredibles.*png$/i)
311+
const incrediblesPosterImg = getByAltText(container, /incredibles.*? poster/i)
312312
```
313313

314314
<!--React-->
@@ -317,13 +317,13 @@ const incrediblesPosterImg = getByAltText(container, /incredibles.*png$/i)
317317
import { render } from 'react-testing-library'
318318

319319
const { getByAltText } = render(<MyComponent />)
320-
const incrediblesPosterImg = getByAltText(/incredibles.*png$/i)
320+
const incrediblesPosterImg = getByAltText(/incredibles.*? poster/i)
321321
```
322322

323323
<!--Cypress-->
324324

325325
```js
326-
cy.getByAltText(/incredibles.*png$/i).should('exist')
326+
cy.getByAltText(/incredibles.*? poster/i).should('exist')
327327
```
328328

329329
<!--END_DOCUSAURUS_CODE_TABS-->

0 commit comments

Comments
 (0)