Skip to content

Commit

Permalink
fix: proper typedefs for role queries (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed Sep 6, 2021
1 parent d88d5dd commit 2a1f1e6
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions lib/typedefs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ByRoleOptions as ByRoleOptions_,
Matcher,
MatcherOptions as MatcherOptions_,
SelectorMatcherOptions as SelectorMatcherOptions_,
Expand All @@ -10,16 +11,7 @@ type Element = ElementHandle

type MatcherOptions = Omit<MatcherOptions_, 'normalizer'>
type SelectorMatcherOptions = Omit<SelectorMatcherOptions_, 'normalizer'>

// tslint:disable-next-line
interface RoleMatcherOptions extends MatcherOptions {
name?: string | RegExp
}

// tslint:disable-next-line
interface SelectorRoleMatcherOptions extends SelectorMatcherOptions {
name?: string | RegExp
}
type ByRoleOptions = Omit<ByRoleOptions_, 'normalizer'>

interface IQueryMethods {
queryByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise<Element | null>
Expand Down Expand Up @@ -124,20 +116,20 @@ interface IQueryMethods {
waitForOpts?: waitForOptions,
): Promise<Element[]>

queryByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element | null>
queryAllByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element[]>
getByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element>
getAllByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element[]>
queryByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element | null>
queryAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element[]>
getByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element>
getAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element[]>
findByRole(
el: Element,
m: Matcher,
opts?: SelectorRoleMatcherOptions,
opts?: ByRoleOptions,
waitForOpts?: waitForOptions,
): Promise<Element>
findAllByRole(
el: Element,
m: Matcher,
opts?: SelectorRoleMatcherOptions,
opts?: ByRoleOptions,
waitForOpts?: waitForOptions,
): Promise<Element[]>

Expand Down

0 comments on commit 2a1f1e6

Please sign in to comment.