From 887591812406ea05a8047f7c2297f8b6df9e2046 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 7 Oct 2019 10:21:55 +0200 Subject: [PATCH 1/3] feat: Add shouldExcludeFromA11yTree --- docs/dom-testing-library/api-helpers.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/dom-testing-library/api-helpers.md b/docs/dom-testing-library/api-helpers.md index 6c8934c20..5e2d9e25c 100644 --- a/docs/dom-testing-library/api-helpers.md +++ b/docs/dom-testing-library/api-helpers.md @@ -77,7 +77,8 @@ for other popular assertion libraries: - [chai-dom](https://github.com/nathanboktae/chai-dom) -If you're aware of some other alternatives, please [make a pull request](https://github.com/testing-library/testing-library-docs/pulls) +If you're aware of some other alternatives, please +[make a pull request](https://github.com/testing-library/testing-library-docs/pulls) and add it here! ## `getNodeText` @@ -185,6 +186,19 @@ console.log(getRoles(nav)) // } ``` +## `shouldExcludeFromA11yTree` + +This function will compute if the given element should be excluded from the +accessibility API by the browser. It implements every **MUST** criteria from +https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion with the exception of +checking the `role` attribute. + +It is defined as: + +```typescript +function shouldExcludeFromA11yTree(element: Element): boolean +``` + ## Debugging When you use any `get` calls in your test cases, the current state of the From 5b1a6ae88c250dd69bdb66fcf692f5f775a53d05 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 10 Oct 2019 09:28:41 +0200 Subject: [PATCH 2/3] Provide text alternative for link --- docs/dom-testing-library/api-helpers.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/dom-testing-library/api-helpers.md b/docs/dom-testing-library/api-helpers.md index 5e2d9e25c..c3837a20e 100644 --- a/docs/dom-testing-library/api-helpers.md +++ b/docs/dom-testing-library/api-helpers.md @@ -189,9 +189,9 @@ console.log(getRoles(nav)) ## `shouldExcludeFromA11yTree` This function will compute if the given element should be excluded from the -accessibility API by the browser. It implements every **MUST** criteria from -https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion with the exception of -checking the `role` attribute. +accessibility API by the browser. It implements every **MUST** criteria from the +[Excluding Elements from the Accessibility Tree](https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion) +section in WAI-ARIA 1.2 with the exception of checking the `role` attribute. It is defined as: From 2b85f19f453611f1ba6fbc3ec99aea6993e9ad13 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Fri, 11 Oct 2019 08:45:25 +0200 Subject: [PATCH 3/3] shouldExcludeFromA11yTree -> isInaccessible --- docs/dom-testing-library/api-helpers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/dom-testing-library/api-helpers.md b/docs/dom-testing-library/api-helpers.md index c3837a20e..1ebdf837b 100644 --- a/docs/dom-testing-library/api-helpers.md +++ b/docs/dom-testing-library/api-helpers.md @@ -186,7 +186,7 @@ console.log(getRoles(nav)) // } ``` -## `shouldExcludeFromA11yTree` +## `isInaccessible` This function will compute if the given element should be excluded from the accessibility API by the browser. It implements every **MUST** criteria from the @@ -196,7 +196,7 @@ section in WAI-ARIA 1.2 with the exception of checking the `role` attribute. It is defined as: ```typescript -function shouldExcludeFromA11yTree(element: Element): boolean +function isInaccessible(element: Element): boolean ``` ## Debugging