fix(ui): 完善界面交互与开发配置
This commit is contained in:
@@ -32,7 +32,12 @@ const context = {
|
||||
};
|
||||
const controls = await loadFrontendModule(
|
||||
new URL('../../src/components/ui/controls.jsx', import.meta.url),
|
||||
{ react: React, antd: Ant, dayjs, '../console/ConsoleContext': context },
|
||||
{
|
||||
react: { ...React, useId: () => 'generated-control-id' },
|
||||
antd: Ant,
|
||||
dayjs,
|
||||
'../console/ConsoleContext': context,
|
||||
},
|
||||
);
|
||||
const ui = await loadFrontendModule(
|
||||
new URL('../../src/components/ui/index.jsx', import.meta.url),
|
||||
@@ -82,6 +87,48 @@ test('legacy controls keep value callbacks and remote search behavior in v6', ()
|
||||
assert.equal(Object.hasOwn(select.props, 'onSearch'), false);
|
||||
});
|
||||
|
||||
test('settings secrets declare autocomplete without changing login fields', () => {
|
||||
context.useConsolePage = () => ({ page: { key: 'setting' } });
|
||||
try {
|
||||
for (const props of [{ mode: 'password' }, { type: 'password' }]) {
|
||||
assert.equal(
|
||||
controls.Input.render(props, null).props.autoComplete,
|
||||
'new-password',
|
||||
);
|
||||
assert.equal(
|
||||
controls.Input.render({ ...props, autoComplete: 'off' }, null).props
|
||||
.autoComplete,
|
||||
'off',
|
||||
);
|
||||
}
|
||||
assert.equal(controls.Input.render({}, null).props.autoComplete, 'off');
|
||||
for (const Control of [
|
||||
controls.Input,
|
||||
controls.TextArea,
|
||||
controls.InputNumber,
|
||||
]) {
|
||||
assert.equal(Control.render({}, null).props.id, 'generated-control-id');
|
||||
assert.equal(
|
||||
Control.render({ id: 'explicit-id' }, null).props.id,
|
||||
'explicit-id',
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
context.useConsolePage = () => null;
|
||||
}
|
||||
assert.equal(
|
||||
controls.Input.render({ mode: 'password' }, null).props.autoComplete,
|
||||
undefined,
|
||||
);
|
||||
assert.equal(
|
||||
controls.Input.render(
|
||||
{ type: 'password', autoComplete: 'current-password' },
|
||||
null,
|
||||
).props.autoComplete,
|
||||
'current-password',
|
||||
);
|
||||
});
|
||||
|
||||
test('card semantic styles survive the legacy adapter without losing slots', () => {
|
||||
const card = ui.Card.render(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user