- 新增 PDF 文档支持,包括格式校验和完整性检查 - 扩展 Word、TXT 和 ZIP 格式附件处理能力 - 添加 Excel 附件可选择仅作为业务文件不解析行数据 - 实现业务助手表格布局配置新增库存和预算字段 - 集成通知、反馈通知等新的业务助手动作类型 - 完善部门管理包含父级部门和排序字段支持 - 增强业务规则校验涵盖更多系统管理场景 - 优化附件上传限制提示信息更准确 - 添加生成文件下载的安全性校验机制 - 扩展测试覆盖确保各业务动作规则正确性
24 lines
1.6 KiB
JavaScript
24 lines
1.6 KiB
JavaScript
import { beforeEach, expect, it, vi } from 'vitest'
|
|
const state=vi.hoisted(()=>({store:{delCachedView:vi.fn(),addCachedView:vi.fn()},router:{currentRoute:{value:{path:'/warehouse/stock',query:{projectId:'1'},hash:'#row-3',meta:{},matched:[]}},replace:vi.fn()}}))
|
|
vi.mock('@/store/modules/tagsView',()=>({default:()=>state.store}))
|
|
vi.mock('@/router',()=>({default:state.router}))
|
|
import tab from '../../src/plugins/tab.js'
|
|
import { registerPageGuard } from '../../src/utils/page-guards.js'
|
|
beforeEach(()=>{vi.clearAllMocks();state.router.currentRoute.value={path:'/warehouse/stock',query:{projectId:'1'},hash:'#row-3',meta:{},matched:[]}})
|
|
it('refresh preserves query and hash instead of losing the current anchor',async()=>{
|
|
expect(await tab.refreshPage()).toBe(true)
|
|
expect(state.router.replace).toHaveBeenCalledExactlyOnceWith({path:'/redirect/warehouse/stock',query:{projectId:'1'},hash:'#row-3'})
|
|
})
|
|
it('repeated clicks while a guard is pending cause one navigation, and cancellation evicts no cache',async()=>{
|
|
let resolve;const stop=registerPageGuard('/warehouse/stock',()=>new Promise(done=>{resolve=done}))
|
|
try{
|
|
const pending=tab.refreshPage();expect(await tab.refreshPage()).toBe(false)
|
|
resolve(false);expect(await pending).toBe(false)
|
|
expect(state.store.delCachedView).not.toHaveBeenCalled();expect(state.router.replace).not.toHaveBeenCalled()
|
|
}finally{stop()}
|
|
})
|
|
it('intermediate redirect route never refreshes itself recursively',async()=>{
|
|
state.router.currentRoute.value.path='/redirect/warehouse/stock'
|
|
expect(await tab.refreshPage()).toBe(false);expect(state.router.replace).not.toHaveBeenCalled()
|
|
})
|