- 新增 ArrivalListTools 和 ArrivalCard 组件用于到货列表管理 - 集成 arrivalListQuery 查询逻辑优化数据加载 - 调整页面标题文字样式增加最小宽度和行高 - 更新底部标签栏字体大小和行高设置 - 重构到货操作界面添加键盘避让视图支持 - 优化到货操作按钮状态管理增加次要按钮样式 - 实现助手组件分页功能支持动态页面大小 - 扩展文件存储区域配置支持项目工作空间 - 增加文件流式上传下载方法支持大文件处理 - 优化采购表格单元格键盘输入体验 - 修复移动端到货操作界面键盘遮挡问题 - 调整测试用例数据量验证分页功能正确性
31 lines
2.0 KiB
JavaScript
31 lines
2.0 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}))
|
|
vi.mock('@/api/project/workspace',()=>({workspaceCapabilities:vi.fn(),workspaceSummary:vi.fn(),memberProjects:vi.fn()}))
|
|
|
|
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()
|
|
})
|