Files
NapCatQQ/.pnpm-store/v3/files/48/6233995fba2a278fac781d173363055fd30f11b419d08f91c5f00576526f377f312a5b9371114f8228ead9f3c47836aa776a05e22185c3b4900fcd366f528f
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

89 lines
1.9 KiB
Plaintext

import test from 'tape';
import isDisabledElement from '../../../src/util/isDisabledElement';
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
test('isDisabledElement', (t) => {
t.test('HTML5', (st) => {
st.equal(
isDisabledElement([
JSXAttributeMock('disabled', 'disabled'),
]),
true,
'identifies HTML5 disabled elements',
);
st.equal(
isDisabledElement([
JSXAttributeMock('disabled', null),
]),
true,
'identifies HTML5 disabled elements with null as the value',
);
st.equal(
isDisabledElement([
JSXAttributeMock('disabled', undefined),
]),
false,
'does not identify HTML5 disabled elements with undefined as the value',
);
st.end();
});
t.test('ARIA', (st) => {
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', 'true'),
]),
true,
'does not identify ARIA disabled elements',
);
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', true),
]),
true,
'does not identify ARIA disabled elements',
);
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', 'false'),
]),
false,
'does not identify ARIA disabled elements',
);
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', false),
]),
false,
'does not identify ARIA disabled elements',
);
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', null),
]),
false,
'does not identify ARIA disabled elements with null as the value',
);
st.equal(
isDisabledElement([
JSXAttributeMock('aria-disabled', undefined),
]),
false,
'does not identify ARIA disabled elements with undefined as the value',
);
st.end();
});
t.end();
});