-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
index.d.ts
149 lines (138 loc) 路 3.16 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import {Simulate as ReactSimulate} from 'react-dom/test-utils'
type TextMatchFunction = (content: string, element: HTMLElement) => boolean
type TextMatch = string | RegExp | TextMatchFunction
type TextMatchOptions = {
exact?: boolean = false
trim?: boolean = true
collapseWhitespace?: boolean = true
}
interface RenderResult {
container: HTMLDivElement
rerender: (ui: React.ReactElement<any>) => void
unmount: VoidFunction
queryByTestId: (
id: TextMatch,
options?: TextMatchOptions,
) => HTMLElement | null
getByTestId: (id: TextMatch, options?: TextMatchOptions) => HTMLElement
queryByText: (id: TextMatch, options?: TextMatchOptions) => HTMLElement | null
getByText: (text: TextMatch, options?: TextMatchOptions) => HTMLElement
queryByPlaceholderText: (
id: TextMatch,
options?: TextMatchOptions,
) => HTMLElement | null
getByPlaceholderText: (
text: TextMatch,
options?: TextMatchOptions,
) => HTMLElement
queryByLabelText: (
text: TextMatch,
options?: TextMatchOptions,
) => HTMLElement | null
getByLabelText: (
id: TextMatch,
options?: {selector?: string} & TextMatchOptions,
) => HTMLElement
queryByAltText: (
text: TextMatch,
options?: TextMatchOptions,
) => HTMLElement | null
getByAltText: (text: TextMatch, options?: TextMatchOptions) => HTMLElement
}
export function render(
ui: React.ReactElement<any>,
options?: {container: HTMLElement},
): RenderResult
export const Simulate: typeof ReactSimulate
export function wait(
callback?: () => void,
options?: {
timeout?: number
interval?: number
},
): Promise<void>
export function waitForElement<T>(
callback?: () => T,
options?: {
container?: HTMLElement
timeout?: number
mutationObserverOptions?: MutationObserverInit
},
): Promise<T | undefined>
type EventType =
| 'copy'
| 'cut'
| 'paste'
| 'compositionEnd'
| 'compositionStart'
| 'compositionUpdate'
| 'keyDown'
| 'keyPress'
| 'keyUp'
| 'focus'
| 'blur'
| 'change'
| 'input'
| 'invalid'
| 'submit'
| 'click'
| 'contextMenu'
| 'dblClick'
| 'drag'
| 'dragEnd'
| 'dragEnter'
| 'dragExit'
| 'dragLeave'
| 'dragOver'
| 'dragStart'
| 'drop'
| 'mouseDown'
| 'mouseEnter'
| 'mouseLeave'
| 'mouseMove'
| 'mouseOut'
| 'mouseOver'
| 'mouseUp'
| 'select'
| 'touchCancel'
| 'touchEnd'
| 'touchMove'
| 'touchStart'
| 'scroll'
| 'wheel'
| 'abort'
| 'canPlay'
| 'canPlayThrough'
| 'durationChange'
| 'emptied'
| 'encrypted'
| 'ended'
| 'loadedData'
| 'loadedMetadata'
| 'loadStart'
| 'pause'
| 'play'
| 'playing'
| 'progress'
| 'rateChange'
| 'seeked'
| 'seeking'
| 'stalled'
| 'suspend'
| 'timeUpdate'
| 'volumeChange'
| 'waiting'
| 'load'
| 'error'
| 'animationStart'
| 'animationEnd'
| 'animationIteration'
| 'transitionEnd'
| 'doubleClick'
type FireFunction = (element: HTMLElement, event: Event) => boolean
type FireObject = {
[K in EventType]: (element: HTMLElement, options?: {}) => boolean
}
export const fireEvent: FireFunction & FireObject
export function renderIntoDocument(ui: React.ReactElement<any>): RenderResult
export function cleanup(): void