feat: 完成分享、单会话与发布审批改造

- 增加工作流协作分享与知识库卡片分享入口,统一低版本浏览器复制反馈

- Web 新登录替换旧会话,并保持 API Key 会话隔离

- 发布审批增加必填说明并在审批详情展示

- 账号重置与导入改用可配置默认强密码
This commit is contained in:
2026-07-23 16:09:31 +08:00
parent caa1f07b66
commit 5a42826d44
71 changed files with 3191 additions and 132 deletions

View File

@@ -0,0 +1,51 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { copyTextWithFeedback } from '../clipboard-feedback';
const { copyTextToClipboard, error, success } = vi.hoisted(() => ({
copyTextToClipboard: vi.fn(),
error: vi.fn(),
success: vi.fn(),
}));
vi.mock('@easyflow/utils', () => ({
copyTextToClipboard,
}));
vi.mock('element-plus', () => ({
ElMessage: {
error,
success,
},
}));
describe('copyTextWithFeedback', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('copies through the shared Chrome 90 compatible helper', async () => {
copyTextToClipboard.mockResolvedValue('exec-command');
await expect(
copyTextWithFeedback('https://example.test/share', '复制成功'),
).resolves.toBe(true);
expect(copyTextToClipboard).toHaveBeenCalledWith(
'https://example.test/share',
);
expect(success).toHaveBeenCalledWith('复制成功');
expect(error).not.toHaveBeenCalled();
});
it('reports a recoverable error when copying fails', async () => {
copyTextToClipboard.mockRejectedValue(new Error('copy denied'));
await expect(
copyTextWithFeedback('content', '复制成功', '复制失败,请手动复制'),
).resolves.toBe(false);
expect(error).toHaveBeenCalledWith('复制失败,请手动复制');
expect(success).not.toHaveBeenCalled();
});
});