|
1 |
| -import {Matcher, MatcherOptions} from './matches' |
| 1 | +import {Matcher, MatcherOptions, ByRoleMatcher} from './matches' |
2 | 2 | import {SelectorMatcherOptions} from './query-helpers'
|
3 | 3 | import {waitForOptions} from './wait-for'
|
4 |
| -import {ARIARole} from 'aria-query' |
5 | 4 |
|
6 | 5 | export type QueryByBoundAttribute = (
|
7 | 6 | container: HTMLElement,
|
@@ -98,67 +97,37 @@ export interface ByRoleOptions extends MatcherOptions {
|
98 | 97 | | ((accessibleName: string, element: Element) => boolean)
|
99 | 98 | }
|
100 | 99 |
|
101 |
| -// disable unified-signatures to have intellisense for aria roles |
102 |
| -/* tslint:disable:unified-signatures */ |
103 |
| -export function AllByRole( |
| 100 | +export type AllByRole = ( |
104 | 101 | container: HTMLElement,
|
105 |
| - role: Matcher, |
| 102 | + role: ByRoleMatcher, |
106 | 103 | options?: ByRoleOptions,
|
107 |
| -): HTMLElement[] |
108 |
| -export function AllByRole( |
109 |
| - container: HTMLElement, |
110 |
| - role: ARIARole, |
111 |
| - options?: ByRoleOptions, |
112 |
| -): HTMLElement[] |
| 104 | +) => HTMLElement[] |
113 | 105 |
|
114 |
| -export function GetByRole( |
115 |
| - container: HTMLElement, |
116 |
| - role: Matcher, |
117 |
| - options?: ByRoleOptions, |
118 |
| -): HTMLElement |
119 |
| -export function GetByRole( |
| 106 | +export type GetByRole = ( |
120 | 107 | container: HTMLElement,
|
121 |
| - role: ARIARole, |
| 108 | + role: ByRoleMatcher, |
122 | 109 | options?: ByRoleOptions,
|
123 |
| -): HTMLElement |
| 110 | +) => HTMLElement |
124 | 111 |
|
125 |
| -export function QueryByRole( |
126 |
| - container: HTMLElement, |
127 |
| - role: Matcher | ByRoleOptions, |
128 |
| - options?: ByRoleOptions, |
129 |
| -): HTMLElement | null |
130 |
| -export function QueryByRole( |
| 112 | +export type QueryByRole = ( |
131 | 113 | container: HTMLElement,
|
132 |
| - role: ARIARole, |
| 114 | + role: ByRoleMatcher, |
133 | 115 | options?: ByRoleOptions,
|
134 |
| -): HTMLElement | null |
| 116 | +) => HTMLElement | null |
135 | 117 |
|
136 |
| -export function FindByRole( |
| 118 | +export type FindByRole = ( |
137 | 119 | container: HTMLElement,
|
138 |
| - role: Matcher, |
| 120 | + role: ByRoleMatcher, |
139 | 121 | options?: ByRoleOptions,
|
140 | 122 | waitForElementOptions?: waitForOptions,
|
141 |
| -): Promise<HTMLElement> |
142 |
| -export function FindByRole( |
143 |
| - container: HTMLElement, |
144 |
| - role: ARIARole, |
145 |
| - options?: ByRoleOptions, |
146 |
| - waitForElementOptions?: waitForOptions, |
147 |
| -): Promise<HTMLElement> |
| 123 | +) => Promise<HTMLElement> |
148 | 124 |
|
149 |
| -export function FindAllByRole( |
| 125 | +export type FindAllByRole = ( |
150 | 126 | container: HTMLElement,
|
151 |
| - role: Matcher, |
| 127 | + role: ByRoleMatcher, |
152 | 128 | options?: ByRoleOptions,
|
153 | 129 | waitForElementOptions?: waitForOptions,
|
154 |
| -): Promise<HTMLElement[]> |
155 |
| -export function FindAllByRole( |
156 |
| - container: HTMLElement, |
157 |
| - role: Matcher, |
158 |
| - options?: ByRoleOptions, |
159 |
| - waitForElementOptions?: waitForOptions, |
160 |
| -): Promise<HTMLElement[]> |
161 |
| -/* tslint:enable */ |
| 130 | +) => Promise<HTMLElement[]> |
162 | 131 |
|
163 | 132 | export const getByLabelText: GetByText
|
164 | 133 | export const getAllByLabelText: AllByText
|
@@ -196,12 +165,12 @@ export const queryByDisplayValue: QueryByBoundAttribute
|
196 | 165 | export const queryAllByDisplayValue: AllByBoundAttribute
|
197 | 166 | export const findByDisplayValue: FindByBoundAttribute
|
198 | 167 | export const findAllByDisplayValue: FindAllByBoundAttribute
|
199 |
| -export const getByRole: typeof GetByRole |
200 |
| -export const getAllByRole: typeof AllByRole |
201 |
| -export const queryByRole: typeof QueryByRole |
202 |
| -export const queryAllByRole: typeof AllByRole |
203 |
| -export const findByRole: typeof FindByRole |
204 |
| -export const findAllByRole: typeof FindAllByRole |
| 168 | +export const getByRole: GetByRole |
| 169 | +export const getAllByRole: AllByRole |
| 170 | +export const queryByRole: QueryByRole |
| 171 | +export const queryAllByRole: AllByRole |
| 172 | +export const findByRole: FindByRole |
| 173 | +export const findAllByRole: FindAllByRole |
205 | 174 | export const getByTestId: GetByBoundAttribute
|
206 | 175 | export const getAllByTestId: AllByBoundAttribute
|
207 | 176 | export const queryByTestId: QueryByBoundAttribute
|
|
0 commit comments