diff --git a/.all-contributorsrc b/.all-contributorsrc
index 975c806a..bb72a094 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -168,6 +168,15 @@
"doc"
]
},
+ {
+ "login": "thchia",
+ "name": "Thomas Chia",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/21194045?v=4",
+ "profile": "https://github.com/thchia",
+ "contributions": [
+ "code"
+ ]
+ },
{
"login": "thiagopaiva99",
"name": "Thiago Galvani",
diff --git a/README.md b/README.md
index 3256e4b7..297ce6f6 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
-[](#contributors)
+[](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
@@ -729,7 +729,7 @@ 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") | [
PaweΕ MikoΕajczyk](https://github.com/Miklet)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=Miklet "Code") | [
Alejandro ΓÑñez Ortiz](http://co.linkedin.com/in/alejandronanez/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=alejandronanez "Documentation") | [
Matt Parrish](https://github.com/pbomb)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Apbomb "Bug reports") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Documentation") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Tests") | [
Justin Hall](https://github.com/wKovacs64)
[π¦](#platform-wKovacs64 "Packaging/porting to new platform") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [
Anto Aravinth](https://github.com/antoaravinth)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Code") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Tests") [π](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Documentation") | [
Jonah Moses](https://github.com/JonahMoses)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=JonahMoses "Documentation") | [
Εukasz Gandecki](http://team.thebrain.pro)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Code") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Tests") [π](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Documentation") | [
Ivan Babak](https://sompylasar.github.io)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Asompylasar "Bug reports") [π€](#ideas-sompylasar "Ideas, Planning, & Feedback") | [
Jesse Day](https://github.com/jday3)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=jday3 "Code") | [
Ernesto GarcΓa](http://gnapse.github.io)
[π¬](#question-gnapse "Answering Questions") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Documentation") | [
Josef Maxx Blake](http://jomaxx.com)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Documentation") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Tests") |
-| [
Michal Baranowski](https://twitter.com/baranovskim)
[π](#blog-mbaranovski "Blogposts") [β
](#tutorial-mbaranovski "Tutorials") | [
Arthur Puthin](https://github.com/aputhin)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [
Thiago Galvani](http://ilegra.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") |
+| [
Michal Baranowski](https://twitter.com/baranovskim)
[π](#blog-mbaranovski "Blogposts") [β
](#tutorial-mbaranovski "Tutorials") | [
Arthur Puthin](https://github.com/aputhin)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [
Thomas Chia](https://github.com/thchia)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Code") | [
Thiago Galvani](http://ilegra.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") |
diff --git a/typings/index.d.ts b/typings/index.d.ts
index d1fbf826..819e4b59 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -1,18 +1,21 @@
import {Simulate as ReactSimulate} from 'react-dom/test-utils'
+type TextMatchFunction = (content: string, element: HTMLElement) => boolean
+type TextMatch = string | RegExp | TextMatchFunction
+
interface RenderResult {
container: HTMLDivElement
unmount: VoidFunction
- queryByTestId: (id: string) => HTMLElement | null
- getByTestId: (id: string) => HTMLElement
- queryByText: (id: string) => HTMLElement | null
- getByText: (id: string) => HTMLElement
- queryByPlaceholderText: (id: string) => HTMLElement | null
- getByPlaceholderText: (id: string) => HTMLElement
- queryByLabelText: (id: string) => HTMLElement | null
- getByLabelText: (id: string) => HTMLElement
- queryByAltText: (text: string) => HTMLElement | null
- getByAltText: (text: string) => HTMLElement
+ queryByTestId: (id: TextMatch) => HTMLElement | null
+ getByTestId: (id: TextMatch) => HTMLElement
+ queryByText: (id: TextMatch) => HTMLElement | null
+ getByText: (text: TextMatch) => HTMLElement
+ queryByPlaceholderText: (id: TextMatch) => HTMLElement | null
+ getByPlaceholderText: (text: TextMatch) => HTMLElement
+ queryByLabelText: (text: TextMatch) => HTMLElement | null
+ getByLabelText: (id: TextMatch, options?: {selector: string}) => HTMLElement
+ queryByAltText: (text: TextMatch) => HTMLElement | null
+ getByAltText: (text: TextMatch) => HTMLElement
}
export function render(