Files
NapCatQQ/.pnpm-store/v3/files/d5/e366624008c73e4bfeab83d06e92bacb7d3cfe108d0fa2f003705c15da2fd3b1ec7a8a407db1ab8863e9079939f1e11c775633cbb75131f8a04f74ff301300
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

36 lines
611 B
Plaintext

import test from 'tape';
import getExplicitRole from '../../../src/util/getExplicitRole';
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
test('getExplicitRole', (t) => {
t.equal(
getExplicitRole(
'div',
[JSXAttributeMock('role', 'button')],
),
'button',
'valid role returns the role',
);
t.equal(
getExplicitRole(
'div',
[JSXAttributeMock('role', 'beeswax')],
),
null,
'invalid role returns null',
);
t.equal(
getExplicitRole(
'div',
[],
),
null,
'no role returns null',
);
t.end();
});