Skip to content

feat(ByRole): Allow filter by busy state #1232

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

Merged
merged 3 commits into from
Mar 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(ByRole): Allow filter by busy state
  • Loading branch information
eps1lon committed Mar 9, 2023
commit 2a956400d64ef03c2672657ea0db5692d7bd6b4b
21 changes: 21 additions & 0 deletions docs/queries/byrole.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ getByRole(
name?: TextMatch,
description?: TextMatch,
selected?: boolean,
busy?: boolean,
checked?: boolean,
pressed?: boolean,
suggest?: boolean,
Expand Down Expand Up @@ -117,6 +118,26 @@ see [ARIA `aria-selected`](https://www.w3.org/TR/wai-aria-1.2/#aria-selected).

### `checked`

You can filter the returned elements by their busy state by setting `busy: true`
or `busy: false`.

For example in

```html
<body>
<section>
<div role="alert" aria-busy="false">Login failed</div>
<div role="alert" aria-busy="true">Error: Loading message...</div>
</section>
</body>
```

you can get the "Login failed" alert by calling
`getByRole('alert', { busy: false })`. To learn more about the busy state see
[ARIA `aria-busy`](https://www.w3.org/TR/wai-aria-1.2/#aria-busy).

### `checked`

You can filter the returned elements by their checked state by setting
`checked: true` or `checked: false`.

Expand Down