feat(testing-library__dom): Add isInaccessible (#39076)

* feat(testing-library__dom): Add isInaccessible

* Fix docs link

* Update types/testing-library__dom/testing-library__dom-tests.ts
This commit is contained in:
Sebastian Silbermann
2019-10-14 13:43:34 -07:00
committed by Andrew Branch
parent 42b40353c9
commit f73f0bf459
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -1,2 +1,7 @@
export function logRoles(container: HTMLElement): string;
export function getRoles(container: HTMLElement): { [index: string]: HTMLElement[] };
/**
* https://testing-library.com/docs/dom-testing-library/api-helpers#isinaccessible
* @param element
*/
export function isInaccessible(element: Element): boolean;
@@ -1,4 +1,4 @@
import { queries } from '@testing-library/dom';
import { queries, isInaccessible } from '@testing-library/dom';
const { getByText, queryByText, findByText, getAllByText, queryAllByText, findAllByText, queryByRole } = queries;
@@ -19,3 +19,8 @@ function testByRole() {
console.assert(queryByRole(element, 'button') === null);
console.assert(queryByRole(element, 'button', { hidden: true }) !== null);
}
function testA11yHelper() {
const element = document.createElement('svg');
console.assert(!isInaccessible(element));
}