From ae644e73bb46be5333223a7ebacd219a08f2a4f2 Mon Sep 17 00:00:00 2001 From: Ekaterina Date: Tue, 18 Sep 2018 12:38:24 +0300 Subject: [PATCH] added a note about triggering onChange event on checkbox to README --- .all-contributorsrc | 9 +++++++++ README.md | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e6246601..7d0b3369 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -503,6 +503,15 @@ "code", "doc" ] + }, + { + "login": "Enikol", + "name": "Kate", + "avatar_url": "https://avatars3.githubusercontent.com/u/19998290?v=4", + "profile": "https://github.com/Enikol", + "contributions": [ + "doc" + ] } ] } diff --git a/README.md b/README.md index 8df34b3b..e8c498fe 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] -[![All Contributors](https://img.shields.io/badge/all_contributors-51-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] [![Join the community on Spectrum][spectrum-badge]][spectrum] @@ -628,6 +628,17 @@ fireEvent.change(comment, { }) ``` +Note that if you want to trigger `onChange` handler on a checkbox, you should +fire a `click` event instead of `change`. + +```javascript +import {render, fireEvent} from 'react-testing-library' + +const {getByLabelText} = render() + +fireEvent.click(getByLabelText('Checkbox')) +``` + ### `waitForElement` > [Read full docs from `dom-testing-library`](https://github.com/kentcdodds/dom-testing-library/blob/master/README.md#waitforelement) @@ -1140,7 +1151,7 @@ Thanks goes to these people ([emoji key][emojis]): | [
Richard Kotze (mobile)](http://www.richardkotze.com)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=rkotze "Documentation") | [
Brahian E. Soto Mercedes](https://github.com/sotobuild)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=sotobuild "Documentation") | [
Benoit de La Forest](https://github.com/bdelaforest)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=bdelaforest "Documentation") | [
Salah](https://github.com/thesalah)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Code") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Tests") | [
Adam Gordon](http://gordonizer.com)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Aicfantv "Bug reports") [πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=icfantv "Code") | [
Matija Marohnić](https://silvenon.com)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=silvenon "Documentation") | [
Justice Mba](https://github.com/Dajust)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Dajust "Documentation") | | [
Mark Pollmann](https://markpollmann.com/)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=MarkPollmann "Documentation") | [
Ehtesham Kafeel](https://github.com/ehteshamkafeel)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=ehteshamkafeel "Code") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=ehteshamkafeel "Documentation") | [
Julio PavΓ³n](http://jpavon.com)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=jpavon "Code") | [
Duncan L](http://www.duncanleung.com/)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=duncanleung "Documentation") [πŸ’‘](#example-duncanleung "Examples") | [
Tiago Almeida](https://www.linkedin.com/in/tyagow/?locale=en_US)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=tyagow "Documentation") | [
Robert Smith](http://rbrtsmith.com/)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Arbrtsmith "Bug reports") | [
Zach Green](https://offbyone.tech)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=zgreen "Documentation") | | [
dadamssg](https://github.com/dadamssg)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=dadamssg "Documentation") | [
Yazan Aabed](https://www.yaabed.com/)
[πŸ“](#blog-YazanAabeed "Blogposts") | [
Tim](https://github.com/timbonicus)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Atimbonicus "Bug reports") [πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=timbonicus "Code") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=timbonicus "Documentation") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=timbonicus "Tests") | [
Divyanshu Maithani](http://divyanshu.xyz)
[βœ…](#tutorial-divyanshu013 "Tutorials") [πŸ“Ή](#video-divyanshu013 "Videos") | [
Deepak Grover](https://www.linkedin.com/in/metagrover)
[βœ…](#tutorial-metagrover "Tutorials") [πŸ“Ή](#video-metagrover "Videos") | [
Eyal Cohen](https://github.com/eyalcohen4)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=eyalcohen4 "Documentation") | [
Peter Makowski](https://github.com/petermakowski)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=petermakowski "Documentation") | -| [
Michiel Nuyts](https://github.com/Michielnuyts)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Michielnuyts "Documentation") | [
Joe Ng'ethe](https://github.com/joeynimu)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=joeynimu "Documentation") | +| [
Michiel Nuyts](https://github.com/Michielnuyts)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Michielnuyts "Documentation") | [
Joe Ng'ethe](https://github.com/joeynimu)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=joeynimu "Code") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=joeynimu "Documentation") | [
Kate](https://github.com/Enikol)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Enikol "Documentation") |