-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml-aria.bench.ts
More file actions
32 lines (27 loc) · 838 Bytes
/
html-aria.bench.ts
File metadata and controls
32 lines (27 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { elementRoles } from 'aria-query';
import { getRole as domAccessibilityApiGetRole } from 'dom-accessibility-api';
import { bench, describe } from 'vitest';
import { getRole } from '../../src/index.js';
describe('getRole (virtual)', () => {
bench('html-aria', () => {
getRole({ tagName: 'input', attributes: { type: 'checkbox' } });
});
bench('aria-query', () => {
elementRoles.get({
name: 'input',
attributes: [{ name: 'type', value: 'checkbox' }],
});
});
});
if (typeof document !== 'undefined') {
describe('getRole (HTMLElement)', () => {
const element = document.createElement('input');
element.type = 'checkbox';
bench('html-aria', () => {
getRole(element);
});
bench('dom-accessibility-api', () => {
domAccessibilityApiGetRole(element);
});
});
}