Skip to content

Commit

Permalink
fix(TS): add JSDoc to typings of exported functions (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkPollmann authored and Kent C. Dodds committed Jun 24, 2018
1 parent e4143e2 commit 71517cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@
"contributions": [
"doc"
]
},
{
"login": "MarkPollmann",
"name": "Mark Pollmann",
"avatar_url": "https://avatars2.githubusercontent.com/u/5286559?v=4",
"profile": "https://markpollmann.com/",
"contributions": [
"doc"
]
}
]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-35-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-36-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]

Expand Down Expand Up @@ -946,6 +946,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [<img src="https://avatars1.githubusercontent.com/u/29602306?v=4" width="100px;"/><br /><sub><b>Michal Baranowski</b></sub>](https://twitter.com/baranovskim)<br />[馃摑](#blog-mbaranovski "Blogposts") [鉁匽(#tutorial-mbaranovski "Tutorials") | [<img src="https://avatars3.githubusercontent.com/u/13985684?v=4" width="100px;"/><br /><sub><b>Arthur Puthin</b></sub>](https://github.com/aputhin)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/21194045?v=4" width="100px;"/><br /><sub><b>Thomas Chia</b></sub>](https://github.com/thchia)<br />[馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Code") [馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/20430611?v=4" width="100px;"/><br /><sub><b>Thiago Galvani</b></sub>](http://ilegra.com/)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/19828824?v=4" width="100px;"/><br /><sub><b>Christian</b></sub>](http://Chriswcs.github.io)<br />[鈿狅笍](https://github.com/kentcdodds/react-testing-library/commits?author=ChrisWcs "Tests") | [<img src="https://avatars3.githubusercontent.com/u/1571667?v=4" width="100px;"/><br /><sub><b>Alex Krolick</b></sub>](https://alexkrolick.com)<br />[馃挰](#question-alexkrolick "Answering Questions") [馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=alexkrolick "Documentation") [馃挕](#example-alexkrolick "Examples") [馃](#ideas-alexkrolick "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/1239401?v=4" width="100px;"/><br /><sub><b>Johann Hubert Sonntagbauer</b></sub>](https://github.com/johann-sonntagbauer)<br />[馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Code") [馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Documentation") [鈿狅笍](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Tests") |
| [<img src="https://avatars2.githubusercontent.com/u/2224291?v=4" width="100px;"/><br /><sub><b>Maddi Joyce</b></sub>](http://www.maddijoyce.com)<br />[馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=maddijoyce "Code") | [<img src="https://avatars2.githubusercontent.com/u/10080111?v=4" width="100px;"/><br /><sub><b>Ryan Vice</b></sub>](http://www.vicesoftware.com)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=RyanAtViceSoftware "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/7942604?v=4" width="100px;"/><br /><sub><b>Ian Wilson</b></sub>](https://ianwilson.io)<br />[馃摑](#blog-iwilsonq "Blogposts") [鉁匽(#tutorial-iwilsonq "Tutorials") | [<img src="https://avatars2.githubusercontent.com/u/1635491?v=4" width="100px;"/><br /><sub><b>Daniel</b></sub>](https://github.com/InExtremaRes)<br />[馃悰](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AInExtremaRes "Bug reports") [馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=InExtremaRes "Code") | [<img src="https://avatars0.githubusercontent.com/u/767959?v=4" width="100px;"/><br /><sub><b>Giorgio Polvara</b></sub>](https://twitter.com/Gpx)<br />[馃悰](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AGpx "Bug reports") [馃](#ideas-Gpx "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/132233?v=4" width="100px;"/><br /><sub><b>John Gozde</b></sub>](https://github.com/jgoz)<br />[馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=jgoz "Code") | [<img src="https://avatars0.githubusercontent.com/u/8203211?v=4" width="100px;"/><br /><sub><b>Sam Horton</b></sub>](https://twitter.com/SavePointSam)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=SavePointSam "Documentation") [馃挕](#example-SavePointSam "Examples") [馃](#ideas-SavePointSam "Ideas, Planning, & Feedback") |
| [<img src="https://avatars2.githubusercontent.com/u/10452163?v=4" width="100px;"/><br /><sub><b>Richard Kotze (mobile)</b></sub>](http://www.richardkotze.com)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=rkotze "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/10819833?v=4" width="100px;"/><br /><sub><b>Brahian E. Soto Mercedes</b></sub>](https://github.com/sotobuild)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=sotobuild "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/7151559?v=4" width="100px;"/><br /><sub><b>Benoit de La Forest</b></sub>](https://github.com/bdelaforest)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=bdelaforest "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/6624197?v=4" width="100px;"/><br /><sub><b>Salah</b></sub>](https://github.com/thesalah)<br />[馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Code") [鈿狅笍](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Tests") | [<img src="https://avatars2.githubusercontent.com/u/370054?v=4" width="100px;"/><br /><sub><b>Adam Gordon</b></sub>](http://gordonizer.com)<br />[馃悰](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Aicfantv "Bug reports") [馃捇](https://github.com/kentcdodds/react-testing-library/commits?author=icfantv "Code") | [<img src="https://avatars2.githubusercontent.com/u/471278?v=4" width="100px;"/><br /><sub><b>Matija Marohni膰</b></sub>](https://silvenon.com)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=silvenon "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/8015514?v=4" width="100px;"/><br /><sub><b>Justice Mba</b></sub>](https://github.com/Dajust)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=Dajust "Documentation") |
| [<img src="https://avatars2.githubusercontent.com/u/5286559?v=4" width="100px;"/><br /><sub><b>Mark Pollmann</b></sub>](https://markpollmann.com/)<br />[馃摉](https://github.com/kentcdodds/react-testing-library/commits?author=MarkPollmann "Documentation") |

<!-- ALL-CONTRIBUTORS-LIST:END -->

Expand Down
15 changes: 15 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ export interface RenderResult extends GetsAndQueries {
unmount: VoidFunction
}

/**
* Render into a container which is appended to document.body. It should be used with cleanup.
*/
export function render(
ui: React.ReactElement<any>,
options?: {container: HTMLElement; baseElement: HTMLElement},
): RenderResult

/**
* When in need to wait for DOM elements to appear, disappear, or change. Prefer waitForElement.
*/
export function wait(
callback?: () => void,
options?: {
Expand All @@ -61,6 +67,9 @@ export function wait(
},
): Promise<void>

/**
* When in need to wait for DOM elements to appear, disappear, or change.
*/
export function waitForElement<T>(
callback?: () => T,
options?: {
Expand Down Expand Up @@ -146,8 +155,14 @@ type FireObject = {
[K in EventType]: (element: HTMLElement, options?: {}) => boolean
}

/**
* Fire DOM events.
*/
export const fireEvent: FireFunction & FireObject

/**
* Unmounts React trees that were mounted with render.
*/
export function cleanup(): void

export function getQueriesForElement(element: HTMLElement): GetsAndQueries

0 comments on commit 71517cf

Please sign in to comment.