Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide roles autocomplete for byRole selector #589

Open
HafizAhmedMoon opened this issue Nov 1, 2022 · 0 comments
Open

Provide roles autocomplete for byRole selector #589

HafizAhmedMoon opened this issue Nov 1, 2022 · 0 comments

Comments

@HafizAhmedMoon
Copy link
Contributor

HafizAhmedMoon commented Nov 1, 2022

Description

The byRole selector doesn't provide autocomplete for roles.

Proposed solution

Provide better typings to autocomplete roles.

import { ByRoleOptions, MatcherFunction } from '@testing-library/dom';
import { ARIARole } from 'aria-query';

export const byRole = (role: ARIARole | MatcherFunction | Omit<string, ARIARole>, options?: ByRoleOptions): DOMSelector =>
  new DOMSelector(el => DOMQueries.queryAllByRole(el, role, options));

Alternatives considered

No alternative considerations.

Do you want to create a pull request?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants