20260917165839
This commit is contained in:
1 parent
182ed86966
commit
38e1e66c3b
108 files changed
+2497
-1215
No files matched your search
@@ -62,6 +62,36 @@ describe('FmsExportDialog 批量导出', () => {
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('全部列已勾选但顺序不同仍可恢复列表顺序', async () => {
|
||||
countExportApi.mockResolvedValue({ data: { total: 8 } })
|
||||
const wrapper = await openDialog({ savedColumns: ['b_amount', 'b_name', 'b_bz'] })
|
||||
expect(buttonByText('全选').disabled).toBe(false)
|
||||
buttonByText('全选').click()
|
||||
await nextTick()
|
||||
await download()
|
||||
expect(exportListApi.mock.calls.at(-1)[0].columns).toEqual(['b_name', 'b_bz', 'b_amount'])
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('重新打开后忽略上次未完成的计数响应', async () => {
|
||||
let finishFirst
|
||||
countExportApi.mockImplementationOnce(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
finishFirst = resolve
|
||||
}),
|
||||
)
|
||||
const wrapper = await openDialog()
|
||||
await wrapper.setProps({ open: false })
|
||||
countExportApi.mockResolvedValueOnce({ data: { total: 7 } })
|
||||
await wrapper.setProps({ open: true, searchCondition: 'b_canuse = 1' })
|
||||
await flushPromises()
|
||||
finishFirst({ data: { total: 100 } })
|
||||
await flushPromises()
|
||||
expect(document.querySelector('.export-dialog__total').textContent).toContain('共 7 条数据')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('打开后渲染全部候选列且默认全选,并显示后端统计的条数', async () => {
|
||||
countExportApi.mockResolvedValue({ data: { total: 8 } })
|
||||
exportListApi.mockResolvedValue('x.xlsx')
|
||||
@@ -104,7 +134,9 @@ describe('FmsExportDialog 批量导出', () => {
|
||||
await openDialog({ savedColumns: ['b_amount', 'b_name'] })
|
||||
|
||||
// 显示顺序 = 已保存顺序 + 未保存的列(未勾选)
|
||||
const names = [...document.querySelectorAll('.export-dialog__field-name')].map((n) => n.textContent)
|
||||
const names = [...document.querySelectorAll('.export-dialog__field-name')].map(
|
||||
(n) => n.textContent,
|
||||
)
|
||||
expect(names).toEqual(['金额', '名称', '备注'])
|
||||
expect(checkboxes().filter((input) => input.checked)).toHaveLength(2)
|
||||
|
||||
@@ -137,7 +169,7 @@ describe('FmsExportDialog 批量导出', () => {
|
||||
expect(params.volumeSize).toBeUndefined()
|
||||
})
|
||||
|
||||
it('分页拆分导出带 volumeSize 且不输出合计', async () => {
|
||||
it('分卷导出带 volumeSize 并沿用默认合计', async () => {
|
||||
countExportApi.mockResolvedValue({ data: { total: 800 } })
|
||||
exportListApi.mockResolvedValue('x.zip')
|
||||
await openDialog()
|
||||
@@ -215,16 +247,18 @@ describe('FmsExportDialog 批量导出', () => {
|
||||
|
||||
it('保存配置上抛字段;全选等于回到列表列并清掉个人覆盖', async () => {
|
||||
countExportApi.mockResolvedValue({ data: { total: 8 } })
|
||||
const wrapper = await openDialog({ savedColumns: ['b_name'] })
|
||||
const wrapper = await openDialog({ savedColumns: ['b_amount'] })
|
||||
|
||||
buttonByText('保存配置').click()
|
||||
await nextTick()
|
||||
expect(wrapper.emitted('save-columns')?.at(-1)).toEqual([['b_name']])
|
||||
expect(wrapper.emitted('save-columns')?.at(-1)).toEqual([['b_amount']])
|
||||
|
||||
buttonByText('全选').click()
|
||||
await nextTick()
|
||||
// 全选 = 回到列表列,顺手清掉个人覆盖(空数组)
|
||||
expect(wrapper.emitted('save-columns')?.at(-1)).toEqual([[]])
|
||||
expect(checkboxes().every((input) => input.checked)).toBe(true)
|
||||
await download()
|
||||
expect(exportListApi.mock.calls.at(-1)[0].columns).toEqual(['b_name', 'b_bz', 'b_amount'])
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user