fix: 统一资源卡片底部操作布局

- 将可见操作紧凑靠左并固定更多菜单位置

- 统一工作流、知识库、智能体和插件卡片密度

- 补充无占位布局回归测试
This commit is contained in:
2026-08-07 12:41:50 +08:00
parent 7a64cfcaa4
commit 4b52d85512
7 changed files with 193 additions and 107 deletions

View File

@@ -89,6 +89,58 @@ describe('cardList', () => {
expect(primaryAction).not.toHaveBeenCalled();
});
it('将可见主操作与行内操作紧凑放在左侧,并将更多菜单独立放在右侧', () => {
const wrapper = mountCardList({
primaryAction: {
text: '编排',
onClick: vi.fn(),
},
actions: [
{
text: '发布',
placement: 'inline',
onClick: vi.fn(),
},
{
text: '删除',
placement: 'menu',
onClick: vi.fn(),
},
],
});
const mainActions = wrapper.get('.card-main-actions');
expect(mainActions.get('.card-primary-hint').text()).toContain('编排');
expect(mainActions.get('.card-actions').text()).toContain('发布');
expect(mainActions.find('.card-action-btn--menu').exists()).toBe(false);
expect(wrapper.find('.card-overflow-action').exists()).toBe(true);
});
it('仅渲染当前可见的行内操作且不保留空占位', () => {
const wrapper = mountCardList({
actions: [
{
text: '编辑',
placement: 'inline',
visible: false,
onClick: vi.fn(),
},
{
text: '运行',
placement: 'inline',
onClick: vi.fn(),
},
],
});
const inlineButtons = wrapper.findAll('.card-actions .card-action-btn');
expect(inlineButtons).toHaveLength(1);
expect(inlineButtons[0]?.text()).toContain('运行');
expect(wrapper.text()).not.toContain('编辑');
});
it('异步次级操作执行中会禁用重复点击并展示加载态', async () => {
const inlineAction = vi.fn();
const wrapper = mountCardList({