- 新增 PDF 文档支持,包括格式校验和完整性检查 - 扩展 Word、TXT 和 ZIP 格式附件处理能力 - 添加 Excel 附件可选择仅作为业务文件不解析行数据 - 实现业务助手表格布局配置新增库存和预算字段 - 集成通知、反馈通知等新的业务助手动作类型 - 完善部门管理包含父级部门和排序字段支持 - 增强业务规则校验涵盖更多系统管理场景 - 优化附件上传限制提示信息更准确 - 添加生成文件下载的安全性校验机制 - 扩展测试覆盖确保各业务动作规则正确性
30 lines
1.9 KiB
JavaScript
30 lines
1.9 KiB
JavaScript
import { beforeEach, expect, test, vi } from 'vitest'
|
|
import { defineComponent, nextTick, ref } from 'vue'
|
|
import { shallowMount } from '@vue/test-utils'
|
|
import ProjectWorkspace from '@/components/ProjectWorkspace/index.vue'
|
|
|
|
const measurement=vi.hoisted(()=>({width:null}))
|
|
const api=vi.hoisted(()=>({getProject:vi.fn(),projectOptions:vi.fn(),projectOverview:vi.fn()}))
|
|
vi.mock('@vueuse/core',()=>({useElementSize:()=>({width:measurement.width})}))
|
|
vi.mock('@/api/project/project',()=>({getProject:api.getProject,projectOptions:api.projectOptions}))
|
|
vi.mock('@/api/production/tasks',()=>({projectOverview:api.projectOverview}))
|
|
|
|
beforeEach(()=>{measurement.width=ref(1126);vi.clearAllMocks()})
|
|
|
|
test('the real project workspace reacts to embedded width without reloading business data',async()=>{
|
|
const descriptions=defineComponent({name:'DescriptionLayout',props:['column'],template:'<section><slot/></section>'})
|
|
const wrapper=shallowMount(ProjectWorkspace,{props:{embedded:true},global:{renderStubDefaultSlot:true,
|
|
stubs:{ElDescriptions:descriptions,ElDescriptionsItem:defineComponent({props:['label'],template:'<div>{{label}}<slot/></div>'}),
|
|
ElSelect:true,ElOption:true,ElTag:true,ElButton:true,ElAlert:true,ElTabs:true,ElTabPane:true},
|
|
directives:{loading:()=>{}},mocks:{$auth:{hasPermiOr:()=>false}}}})
|
|
await wrapper.setData({project:{id:1501,projectName:'很长的项目名称用于布局回归',projectCode:'TEST',projectType:'RESEARCH',projectStatus:1,totalAmount:100}})
|
|
for(const [width,columns] of [[1126,3],[632,2],[335,1],[980,3]]) {
|
|
measurement.width.value=width;await nextTick()
|
|
expect(wrapper.findComponent(descriptions).props('column')).toBe(columns)
|
|
expect(wrapper.text()).toContain('很长的项目名称用于布局回归')
|
|
expect(wrapper.text()).toContain('项目类型')
|
|
}
|
|
expect(api.getProject).not.toHaveBeenCalled();expect(api.projectOverview).not.toHaveBeenCalled()
|
|
wrapper.unmount()
|
|
})
|