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