Skip to content

Commit 3fb77d3

Browse files
nickservKent C. Dodds
authored and
Kent C. Dodds
committed
docs: replace getElementByText with getByText (#150)
Related to testing-library/dom-testing-library#82. <!-- Thanks for your interest in the project. Bugs filed and PRs submitted are appreciated! Please make sure that you are familiar with and follow the Code of Conduct for this project (found in the CODE_OF_CONDUCT.md file). Also, please make sure you're familiar with and follow the instructions in the contributing guidelines (found in the CONTRIBUTING.md file). If you're new to contributing to open source projects, you might find this free video course helpful: http://kcd.im/pull-request Please fill out the information below to expedite the review and (hopefully) merge of your pull request! --> <!-- What changes are being made? (What feature/bug is being fixed here?) --> **What**: Use getByText instead of getElementByText in a code example, which seems like it was a typo. <!-- Why are these changes necessary? --> **Why**: getElementByText is not exported by dom-testing-library as far as I'm aware, which could be confusing. <!-- Have you done all of these things? --> **Checklist**: <!-- add "N/A" to the end of each line that's irrelevant to your changes --> <!-- to check an item, place an "x" in the box like so: "- [x] Documentation" --> * [x] Documentation * [ ] Tests: N/A * [x] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? --> * [x] Added myself to contributors table <!-- this is optional, see the contributing guidelines for instructions --> <!-- feel free to add additional comments -->
1 parent 9667967 commit 3fb77d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ for a full list as well as default `eventProperties`.
506506
```javascript
507507
import {render, fireEvent} from 'react-testing-library'
508508

509-
const {getElementByText} = render(<Form />)
509+
const {getByText} = render(<Form />)
510510

511511
// similar to the above example
512512
// click will bubble for React to see it
513513
const rightClick = {button: 2}
514-
fireEvent.click(getElementByText('Submit'), rightClick)
514+
fireEvent.click(getByText('Submit'), rightClick)
515515
// default `button` property for click events is set to `0` which is a left click.
516516
```
517517

0 commit comments

Comments
 (0)