fix: 统一详情页返回上级列表
- 修正管理端插件、工作流与系统详情页返回目标 - 修正用户中心执行记录与助手详情返回目标 - 保留审批页签及关联资源筛选上下文
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
function readViewSource(relativePath: string) {
|
||||
return readFileSync(resolve('app/src/views', relativePath), 'utf8');
|
||||
}
|
||||
|
||||
describe('detail return navigation', () => {
|
||||
it.each([
|
||||
['system/sysFeedback/sysFeedbackDetail.vue', '/sys/sysFeedback'],
|
||||
['system/sysJob/SysJobLogList.vue', '/sys/sysJob'],
|
||||
['ai/workflow/WorkflowDesign.vue', '/ai/workflow'],
|
||||
['ai/workflow/RunPage.vue', '/ai/workflow'],
|
||||
['ai/workflow/execute/WorkflowExecResultList.vue', '/ai/workflow'],
|
||||
])('returns %s to its fixed parent list', (relativePath, parentPath) => {
|
||||
const source = readViewSource(relativePath);
|
||||
|
||||
expect(source).not.toMatch(/router\.(?:back|go)\s*\(/);
|
||||
expect(source).toContain(`path: '${parentPath}'`);
|
||||
});
|
||||
|
||||
it('returns approval details to the originating approval tab', () => {
|
||||
const detailSource = readViewSource('system/approval/ApprovalDetail.vue');
|
||||
const listSource = readViewSource('system/approval/ApprovalManage.vue');
|
||||
|
||||
expect(detailSource).not.toMatch(/router\.(?:back|go)\s*\(/);
|
||||
expect(detailSource).toContain("path: '/sys/approval'");
|
||||
expect(detailSource).toContain('query: { tab }');
|
||||
expect(listSource).toContain('tab: activeTab.value');
|
||||
});
|
||||
|
||||
it('returns plugin tool editing to its plugin tool list with a safe fallback', () => {
|
||||
const editSource = readViewSource('ai/plugin/PluginToolEdit.vue');
|
||||
const listSource = readViewSource('ai/plugin/PluginToolTable.vue');
|
||||
|
||||
expect(editSource).not.toMatch(/router\.(?:back|go)\s*\(/);
|
||||
expect(editSource).toContain("path: '/ai/plugin/tools'");
|
||||
expect(editSource).toContain("path: '/ai/plugin'");
|
||||
expect(listSource).toContain('pluginId: props.pluginId');
|
||||
});
|
||||
|
||||
it('returns execution steps to the filtered execution record list', () => {
|
||||
const stepSource = readViewSource(
|
||||
'ai/workflow/execute/WorkflowExecStepList.vue',
|
||||
);
|
||||
const recordSource = readViewSource(
|
||||
'ai/workflow/execute/WorkflowExecResultList.vue',
|
||||
);
|
||||
|
||||
expect(stepSource).not.toMatch(/router\.(?:back|go)\s*\(/);
|
||||
expect(stepSource).toContain("name: 'ExecRecord'");
|
||||
expect(stepSource).toContain('query: workflowId ? { workflowId } : {}');
|
||||
expect(recordSource).toContain('workflowId: $route.query.workflowId');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user