Files
NapCatQQ/.pnpm-store/v3/files/94/51ada83da69355faff768bf77bd3122097007658373a9e08d0ae2306a81e4fcb1aaf1f11418a182343aa872c8c1ea53d39181a4bb125f013e0ab2e314164a0
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

72 lines
1.3 KiB
Plaintext

import test from 'tape';
import getComputedRole from '../../../src/util/getComputedRole';
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
test('getComputedRole', (t) => {
t.equal(
getComputedRole(
'div',
[JSXAttributeMock('role', 'button')],
),
'button',
'explicit role + valid role -> returns the role',
);
t.equal(
getComputedRole(
'li',
[JSXAttributeMock('role', 'beeswax')],
),
'listitem',
'explicit role + invalid role + has implicit -> returns the implicit role',
);
t.equal(
getComputedRole(
'div',
[JSXAttributeMock('role', 'beeswax')],
),
null,
'explicit role + invalid role + lacks implicit -> returns null',
);
t.equal(
getComputedRole(
'li',
[],
),
'listitem',
'explicit role + no role + has implicit -> returns the implicit role',
);
t.equal(
getComputedRole(
'div',
[],
),
null,
'explicit role + no role + lacks implicit -> returns null',
);
t.equal(
getComputedRole(
'li',
[JSXAttributeMock('role', 'beeswax')],
),
'listitem',
'implicit role + has implicit -> returns the implicit role',
);
t.equal(
getComputedRole(
'div',
[],
),
null,
'implicit role + lacks implicit -> returns null',
);
t.end();
});