diff --git a/.all-contributorsrc b/.all-contributorsrc index 394eaaeb..3b0d20e2 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -37,6 +37,15 @@ "contributions": [ "code" ] + }, + { + "login": "Miklet", + "name": "Paweł Mikołajczyk", + "avatar_url": "https://avatars2.githubusercontent.com/u/12592677?v=4", + "profile": "https://github.com/Miklet", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index b6f442bb..47c67cd0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] @@ -354,8 +354,8 @@ Thanks goes to these people ([emoji key][emojis]): -| [
Kent C. Dodds](https://kentcdodds.com)
[💻](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [
Ryan Castner](http://audiolion.github.io)
[📖](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [
Daniel Sandiego](https://www.dnlsandiego.com)
[💻](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") | -| :---: | :---: | :---: | +| [
Kent C. Dodds](https://kentcdodds.com)
[💻](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [
Ryan Castner](http://audiolion.github.io)
[📖](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [
Daniel Sandiego](https://www.dnlsandiego.com)
[💻](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") | [
Paweł Mikołajczyk](https://github.com/Miklet)
[💻](https://github.com/kentcdodds/react-testing-library/commits?author=Miklet "Code") | +| :---: | :---: | :---: | :---: | diff --git a/package.json b/package.json index 58881938..a442d0a7 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.0-semantically-released", "description": "Simple and complete React DOM testing utilities that encourage good testing practices.", "main": "dist/index.js", + "typings": "typings/index.d.ts", "engines": { "node": ">=8", "npm": ">=5" @@ -25,6 +26,7 @@ "license": "MIT", "dependencies": {}, "devDependencies": { + "@types/react-dom": "^16.0.4", "axios": "^0.18.0", "history": "^4.7.2", "kcd-scripts": "^0.36.1", @@ -58,4 +60,4 @@ "url": "https://github.com/kentcdodds/react-testing-library/issues" }, "homepage": "https://github.com/kentcdodds/react-testing-library#readme" -} +} \ No newline at end of file diff --git a/typings/index.d.ts b/typings/index.d.ts new file mode 100644 index 00000000..ab239595 --- /dev/null +++ b/typings/index.d.ts @@ -0,0 +1,16 @@ +import {Simulate as ReactSimulate} from 'react-dom/test-utils' + +interface RenderResult { + container: HTMLDivElement + unmount: VoidFunction + queryByTestId: (id: string) => HTMLElement | null +} + +export function render( + ui: React.ReactElement, + options?: {container: HTMLElement}, +): RenderResult + +export function flushPromises(): Promise + +export const Simulate: typeof ReactSimulate