@@ -2,22 +2,44 @@ import {Simulate as ReactSimulate} from 'react-dom/test-utils'
22
33type TextMatchFunction = ( content : string , element : HTMLElement ) => boolean
44type TextMatch = string | RegExp | TextMatchFunction
5- type ExactTextMatch = string | RegExp | TextMatchFunction
5+ type TextMatchOptions = {
6+ exact ?: boolean = false
7+ trim ?: boolean = true
8+ collapseWhitespace ?: boolean = true
9+ }
610
711interface RenderResult {
812 container : HTMLDivElement
913 rerender : ( ui : React . ReactElement < any > ) => void
1014 unmount : VoidFunction
11- queryByTestId : ( id : ExactTextMatch ) => HTMLElement | null
12- getByTestId : ( id : ExactTextMatch ) => HTMLElement
13- queryByText : ( id : TextMatch ) => HTMLElement | null
14- getByText : ( text : TextMatch ) => HTMLElement
15- queryByPlaceholderText : ( id : TextMatch ) => HTMLElement | null
16- getByPlaceholderText : ( text : TextMatch ) => HTMLElement
17- queryByLabelText : ( text : TextMatch ) => HTMLElement | null
18- getByLabelText : ( id : TextMatch , options ?: { selector : string } ) => HTMLElement
19- queryByAltText : ( text : TextMatch ) => HTMLElement | null
20- getByAltText : ( text : TextMatch ) => HTMLElement
15+ queryByTestId : (
16+ id : TextMatch ,
17+ options ?: TextMatchOptions ,
18+ ) => HTMLElement | null
19+ getByTestId : ( id : TextMatch , options ?: TextMatchOptions ) => HTMLElement
20+ queryByText : ( id : TextMatch , options ?: TextMatchOptions ) => HTMLElement | null
21+ getByText : ( text : TextMatch , options ?: TextMatchOptions ) => HTMLElement
22+ queryByPlaceholderText : (
23+ id : TextMatch ,
24+ options ?: TextMatchOptions ,
25+ ) => HTMLElement | null
26+ getByPlaceholderText : (
27+ text : TextMatch ,
28+ options ?: TextMatchOptions ,
29+ ) => HTMLElement
30+ queryByLabelText : (
31+ text : TextMatch ,
32+ options ?: TextMatchOptions ,
33+ ) => HTMLElement | null
34+ getByLabelText : (
35+ id : TextMatch ,
36+ options ?: { selector : string ; TextMatchOptions } ,
37+ ) => HTMLElement
38+ queryByAltText : (
39+ text : TextMatch ,
40+ options ?: TextMatchOptions ,
41+ ) => HTMLElement | null
42+ getByAltText : ( text : TextMatch , options ?: TextMatchOptions ) => HTMLElement
2143}
2244
2345export function render (
0 commit comments