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
72 lines
1.3 KiB
Plaintext
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();
|
|
});
|