fix(ui): 统一表格交互,调整企业技能与质量页面,修复浮层引用警告

This commit is contained in:
zhanjunhao
2026-11-24 13:26:07 +08:00
parent bf708039a3
commit 4e7894f144
124 changed files with 2682 additions and 1810 deletions
+72
View File
@@ -0,0 +1,72 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import React from 'react';
import { loadFrontendModule } from './frontend-module.js';
const { default: TableStatusSwitch } = await loadFrontendModule(
new URL(
'../../src/components/common/table/TableStatusSwitch.jsx',
import.meta.url,
),
{
react: React,
antd: { Switch: 'mock-switch' },
'react-i18next': { useTranslation: () => ({ t: (key) => key }) },
},
);
const { default: TableGroupTags, TableGroupTag } = await loadFrontendModule(
new URL(
'../../src/components/common/table/TableGroupTags.jsx',
import.meta.url,
),
{ react: React, antd: { Tag: 'mock-tag' }, './table-group-tags.css': {} },
);
test('table switches share a compact appearance without replacing row actions', () => {
const onChange = () => {};
const ref = React.createRef();
const { props, ref: switchRef } = TableStatusSwitch.render(
{
checked: false,
size: 'large',
disabled: true,
loading: true,
onChange,
},
ref,
);
assert.equal(switchRef, ref);
assert.equal(props.size, 'small');
assert.equal(props.checkedChildren, '启用');
assert.equal(props.unCheckedChildren, '禁用');
assert.equal(props.checked, false);
assert.equal(props.disabled, true);
assert.equal(props.loading, true);
assert.equal(props.onChange, onChange);
assert.equal(
TableStatusSwitch.render({ checkedChildren: '是' }, null).props
.checkedChildren,
'是',
);
});
test('single and multiple groups use one outlined color mapping', () => {
const { props } = TableGroupTags({
groups: ['default, svip', ' vip ', 'default', 'custom', ''],
});
const tags = Array.from(
props.children,
(child) => TableGroupTag(child.props).props,
);
assert.deepEqual(
tags.map((tag) => tag.children),
['default', 'svip', 'vip', 'custom'],
);
assert.deepEqual(
tags.map((tag) => tag.color),
['blue', 'red', 'yellow', 'default'],
);
assert.ok(tags.every((tag) => tag.variant === 'outlined'));
assert.equal(TableGroupTag({ group: 'VIP' }).props.color, 'yellow');
assert.equal(TableGroupTags({ groups: null, empty: 'fallback' }), 'fallback');
});