Skip to content

Commit 220e2cd

Browse files
committed
feat: Add shouldExcludeFromA11yTree
1 parent 72f230d commit 220e2cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/dom-testing-library/api-helpers.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ for other popular assertion libraries:
7777

7878
- [chai-dom](https://github.com/nathanboktae/chai-dom)
7979

80-
If you're aware of some other alternatives, please [make a pull request](https://github.com/testing-library/testing-library-docs/pulls)
80+
If you're aware of some other alternatives, please
81+
[make a pull request](https://github.com/testing-library/testing-library-docs/pulls)
8182
and add it here!
8283

8384
## `getNodeText`
@@ -185,6 +186,19 @@ console.log(getRoles(nav))
185186
// }
186187
```
187188

189+
## `shouldExcludeFromA11yTree`
190+
191+
This function will compute if the given element should be excluded from the
192+
accessibility API by the browser. It implements every **MUST** criteria from
193+
https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion with the exception of
194+
checking the `role` attribute.
195+
196+
It is defined as:
197+
198+
```typescript
199+
function shouldExcludeFromA11yTree(element: Element): boolean
200+
```
201+
188202
## Debugging
189203

190204
When you use any `get` calls in your test cases, the current state of the

0 commit comments

Comments
 (0)