20260921231313
This commit is contained in:
1 parent
ac710c1801
commit
583984c24f
81 files changed
+2523
-288
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 批量导出弹窗:选列、三种导出方式、保存导出列。
|
||||
* 自定义导出弹窗:选列、三种导出方式、保存导出列。
|
||||
*
|
||||
* Modal 用 Teleport 挂到 body,所以断言都从 document 上找节点(与 modal-confirm.spec.js 一致)。
|
||||
* 这里守住的是「弹窗参数拼得对不对」—— 导出本身由后端测试覆盖,前端错在这里最容易漏。
|
||||
@@ -56,7 +56,7 @@ async function download() {
|
||||
await nextTick()
|
||||
}
|
||||
|
||||
describe('FmsExportDialog 批量导出', () => {
|
||||
describe('FmsExportDialog 自定义导出', () => {
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks()
|
||||
document.body.innerHTML = ''
|
||||
|
||||
@@ -9,9 +9,9 @@ import { menuRouteOptions, routes } from '@/router/routes'
|
||||
* 页面会下沉一层、脱离 DefaultLayout 的 keep-alive,缓存静默失效。
|
||||
*
|
||||
* 2. 分组节点也不配 redirect:分组只是归类,不该自带「默认落地页」语义。
|
||||
* 直接访问 /base、/module 这类裸前缀时,交给表尾的 /:pathMatch(.*)* 兜到工作台
|
||||
* (/dashboard)—— 业务入口一律由 s_menu + 路由地址维护,避免出现「菜单上没配、
|
||||
* 却能落在某个页面」的第二入口。
|
||||
* 直接访问 /base、/module 这类裸前缀时,交给表尾的 /:pathMatch(.*)* 渲染 404 缺省页
|
||||
* —— 业务入口一律由 s_menu + 路由地址维护,避免出现「菜单上没配、却能落在某个页面」
|
||||
* 的第二入口。
|
||||
*/
|
||||
function createTestRouter() {
|
||||
return createRouter({ history: createMemoryHistory(), routes })
|
||||
@@ -40,12 +40,14 @@ describe('路由分组(嵌套结构)', () => {
|
||||
expect(group.redirect).toBeFalsy()
|
||||
})
|
||||
|
||||
it('访问分组裸前缀时兜到工作台,不白屏', async () => {
|
||||
it('访问分组裸前缀时落入 404 缺省页,不白屏也不落业务页', async () => {
|
||||
const router = createTestRouter()
|
||||
await router.push('/module')
|
||||
|
||||
// 分组无 component、无 redirect,裸前缀由表尾 /:pathMatch(.*)* 兜底
|
||||
expect(router.currentRoute.value.path).toBe('/dashboard')
|
||||
// 分组无 component、无 redirect,裸前缀由表尾 /:pathMatch(.*)* 渲染 404 缺省页;
|
||||
// 地址保留原样不重定向,用户能看到自己输错的是什么
|
||||
expect(router.currentRoute.value.name).toBe('fallback-404')
|
||||
expect(router.currentRoute.value.path).toBe('/module')
|
||||
})
|
||||
|
||||
it('菜单路由选项:排除模块中心(adminOnly)整组与分组节点/动态/通配路由', () => {
|
||||
@@ -57,9 +59,11 @@ describe('路由分组(嵌套结构)', () => {
|
||||
expect(values).not.toContain('/module/menu-management')
|
||||
expect(values).not.toContain('/module/i18n-type')
|
||||
expect(values).toContain('/dashboard')
|
||||
// 分组节点本身、详情页(:id)、404 通配、登录页都不是菜单入口
|
||||
// 分组节点本身、详情页(:id)、404 通配、登录页与缺省页都不是菜单入口
|
||||
expect(values).not.toContain('/module')
|
||||
expect(values).not.toContain('/detail/:id')
|
||||
expect(values).not.toContain('/login')
|
||||
expect(values).not.toContain('/403')
|
||||
expect(values).not.toContain('/500')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user