diff --git a/typings/queries.d.ts b/typings/queries.d.ts index 18a2c941..240f454f 100644 --- a/typings/queries.d.ts +++ b/typings/queries.d.ts @@ -1,5 +1,6 @@ import {Matcher, MatcherOptions} from './matches' import {SelectorMatcherOptions} from './query-helpers' +import {WaitForElementOptions} from './wait-for-element' export type QueryByBoundAttribute = ( container: HTMLElement, @@ -13,12 +14,26 @@ export type AllByBoundAttribute = ( options?: MatcherOptions, ) => HTMLElement[] +export type FindAllByBoundAttribute = ( + container: HTMLElement, + id: Matcher, + options?: MatcherOptions, + waitForElementOptions?: WaitForElementOptions +) => Promise | Error + export type GetByBoundAttribute = ( container: HTMLElement, id: Matcher, options?: MatcherOptions, ) => HTMLElement +export type FindByBoundAttribute = ( + container: HTMLElement, + id: Matcher, + options?: MatcherOptions, + waitForElementOptions?: WaitForElementOptions +) => Promise | Error + export type QueryByText = ( container: HTMLElement, id: Matcher, @@ -31,49 +46,79 @@ export type AllByText = ( options?: SelectorMatcherOptions, ) => HTMLElement[] +export type FindAllByText = ( + container: HTMLElement, + id: Matcher, + options?: SelectorMatcherOptions, + waitForElementOptions?: WaitForElementOptions +) => Promise | Error + export type GetByText = ( container: HTMLElement, id: Matcher, options?: SelectorMatcherOptions, ) => HTMLElement -export const queryByPlaceholderText: QueryByBoundAttribute -export const queryAllByPlaceholderText: AllByBoundAttribute +export type FindByText = ( + container: HTMLElement, + id: Matcher, + options?: SelectorMatcherOptions, + waitForElementOptions?: WaitForElementOptions +) => Promise | Error + +export const getByLabelText: GetByText +export const getAllByLabelText: AllByText +export const queryByLabelText: QueryByText +export const queryAllByLabelText: AllByText +export const findByLabelText: FindByText +export const findAllByLabelText: FindAllByText export const getByPlaceholderText: GetByBoundAttribute export const getAllByPlaceholderText: AllByBoundAttribute -export const queryBySelectText: QueryByBoundAttribute -export const queryAllBySelectText: AllByBoundAttribute -export const getBySelectText: GetByBoundAttribute -export const getAllBySelectText: AllByBoundAttribute -export const queryByText: QueryByText -export const queryAllByText: AllByText +export const queryByPlaceholderText: QueryByBoundAttribute +export const queryAllByPlaceholderText: AllByBoundAttribute +export const findByPlaceholderText: FindByBoundAttribute +export const findAllByPlaceholderText: FindAllByBoundAttribute export const getByText: GetByText export const getAllByText: AllByText -export const queryByLabelText: QueryByText -export const queryAllByLabelText: AllByText -export const getByLabelText: GetByText -export const getAllByLabelText: AllByText -export const queryByAltText: QueryByBoundAttribute -export const queryAllByAltText: AllByBoundAttribute +export const queryByText: QueryByText +export const queryAllByText: AllByText +export const findByText: FindByText +export const findAllByText: FindAllByText export const getByAltText: GetByBoundAttribute export const getAllByAltText: AllByBoundAttribute -export const queryByTestId: QueryByBoundAttribute -export const queryAllByTestId: AllByBoundAttribute -export const getByTestId: GetByBoundAttribute -export const getAllByTestId: AllByBoundAttribute -export const queryByTitle: QueryByBoundAttribute -export const queryAllByTitle: AllByBoundAttribute +export const queryByAltText: QueryByBoundAttribute +export const queryAllByAltText: AllByBoundAttribute +export const findByAltText: FindByBoundAttribute +export const findAllByAltText: FindAllByBoundAttribute export const getByTitle: GetByBoundAttribute export const getAllByTitle: AllByBoundAttribute -export const queryByValue: QueryByBoundAttribute -export const queryAllByValue: AllByBoundAttribute -export const getByValue: GetByBoundAttribute -export const getAllByValue: AllByBoundAttribute -export const queryByDisplayValue: QueryByBoundAttribute -export const queryAllByDisplayValue: AllByBoundAttribute +export const queryByTitle: QueryByBoundAttribute +export const queryAllByTitle: AllByBoundAttribute +export const findByTitle: FindByBoundAttribute +export const findAllByTitle: FindAllByBoundAttribute export const getByDisplayValue: GetByBoundAttribute export const getAllByDisplayValue: AllByBoundAttribute -export const queryByRole: QueryByBoundAttribute -export const queryAllByRole: AllByBoundAttribute +export const queryByDisplayValue: QueryByBoundAttribute +export const queryAllByDisplayValue: AllByBoundAttribute +export const findByDisplayValue: FindByBoundAttribute +export const findAllByDisplayValue: FindAllByBoundAttribute export const getByRole: GetByBoundAttribute export const getAllByRole: AllByBoundAttribute +export const queryByRole: QueryByBoundAttribute +export const queryAllByRole: AllByBoundAttribute +export const findByRole: FindByBoundAttribute +export const findAllByRole: FindAllByBoundAttribute +export const getByTestId: GetByBoundAttribute +export const getAllByTestId: AllByBoundAttribute +export const queryByTestId: QueryByBoundAttribute +export const queryAllByTestId: AllByBoundAttribute +export const findByTestId: FindByBoundAttribute +export const findAllByTestId: FindAllByBoundAttribute +export const getBySelectText: GetByBoundAttribute +export const getAllBySelectText: AllByBoundAttribute +export const queryBySelectText: QueryByBoundAttribute +export const queryAllBySelectText: AllByBoundAttribute +export const getByValue: GetByBoundAttribute +export const getAllByValue: AllByBoundAttribute +export const queryByValue: QueryByBoundAttribute +export const queryAllByValue: AllByBoundAttribute diff --git a/typings/wait-for-element.d.ts b/typings/wait-for-element.d.ts index d5217a05..fa9f5100 100644 --- a/typings/wait-for-element.d.ts +++ b/typings/wait-for-element.d.ts @@ -1,8 +1,10 @@ +export interface WaitForElementOptions { + container?: HTMLElement + timeout?: number + mutationObserverOptions?: MutationObserverInit +} + export function waitForElement( callback: () => T, - options?: { - container?: HTMLElement - timeout?: number - mutationObserverOptions?: MutationObserverInit - }, + options?: WaitForElementOptions, ): Promise