mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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:
parent
42b40353c9
commit
f73f0bf459
5
types/testing-library__dom/role-helpers.d.ts
vendored
5
types/testing-library__dom/role-helpers.d.ts
vendored
@ -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));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user