- 新增 ArrivalListTools 和 ArrivalCard 组件用于到货列表管理 - 集成 arrivalListQuery 查询逻辑优化数据加载 - 调整页面标题文字样式增加最小宽度和行高 - 更新底部标签栏字体大小和行高设置 - 重构到货操作界面添加键盘避让视图支持 - 优化到货操作按钮状态管理增加次要按钮样式 - 实现助手组件分页功能支持动态页面大小 - 扩展文件存储区域配置支持项目工作空间 - 增加文件流式上传下载方法支持大文件处理 - 优化采购表格单元格键盘输入体验 - 修复移动端到货操作界面键盘遮挡问题 - 调整测试用例数据量验证分页功能正确性
36 lines
2.7 KiB
JavaScript
36 lines
2.7 KiB
JavaScript
import { expect, it, vi } from 'vitest'
|
|
import { defineComponent, effectScope, nextTick, reactive } from 'vue'
|
|
import { mount, shallowMount, flushPromises } from '@vue/test-utils'
|
|
import ElementPlus from 'element-plus'
|
|
import { useAssistantPagination } from '@/utils/assistant-pagination'
|
|
import Preview from '@/components/BusinessAssistant/AssistantReferencePricePreview.vue'
|
|
import Draft from '@/components/BusinessAssistant/AssistantDraft.vue'
|
|
vi.mock('@/components/BusinessAssistant/AssistantField.vue',()=>({default:{template:'<span/>'}}))
|
|
|
|
it('defaults to 50 rows, supports 20/50/100, resets on resizing, and clamps after exclusions',()=>{
|
|
const scope=effectScope(),rows=reactive(Array.from({length:121},(_,id)=>({id})))
|
|
try{
|
|
const pager=scope.run(()=>useAssistantPagination(()=>rows))
|
|
expect(pager.pageRows.value).toHaveLength(50);expect(pager.pageSizes).toEqual([20,50,100])
|
|
pager.page.value=3;expect(pager.pageRows.value).toHaveLength(21)
|
|
pager.pageSize.value=100;expect(pager.page.value).toBe(1);expect(pager.pageRows.value).toHaveLength(100)
|
|
pager.page.value=2;rows.splice(10);expect(pager.page.value).toBe(1);expect(pager.pageRows.value).toHaveLength(10)
|
|
}finally{scope.stop()}
|
|
})
|
|
it('a real AI price preview displays all 34 quote items on its first page',async()=>{
|
|
const wrapper=mount(Preview,{props:{rows:Array.from({length:34},(_,id)=>({name:`报价物品${id+1}`,quantity:1,newActualPrice:id,newActualAmount:id}))},global:{plugins:[ElementPlus]}})
|
|
try{await flushPromises();expect(wrapper.findAll('.el-table__body tbody tr')).toHaveLength(34);expect(wrapper.find('.el-pagination').text()).toContain('34')}
|
|
finally{wrapper.unmount()}
|
|
})
|
|
it('the AI confirmation table renders 50 rows and changing to 100 resets the page without losing rows',async()=>{
|
|
const table=defineComponent({props:['data'],template:'<div><slot/></div>'}),pager=defineComponent({emits:['update:currentPage','update:pageSize'],template:'<div/>'})
|
|
const rows=Array.from({length:103},(_,id)=>({_rowId:String(id),userName:`测试用户${id}`}))
|
|
const wrapper=shallowMount(Draft,{props:{draft:{id:'test-pagination',version:1,status:'DRAFT',action:'user.create',fields:[{key:'userName',label:'账号'}]},rows},global:{stubs:{ElTable:table,ElTableColumn:true,ElPagination:pager}}})
|
|
try{
|
|
expect(wrapper.findComponent(table).props('data')).toHaveLength(50)
|
|
wrapper.findComponent(pager).vm.$emit('update:currentPage',3);await nextTick();expect(wrapper.findComponent(table).props('data')).toHaveLength(3)
|
|
wrapper.findComponent(pager).vm.$emit('update:pageSize',100);await nextTick();expect(wrapper.findComponent(table).props('data')).toHaveLength(100)
|
|
expect(rows).toHaveLength(103);expect(wrapper.emitted('change')).toBeUndefined()
|
|
}finally{wrapper.unmount()}
|
|
})
|