优化
This commit is contained in:
@@ -28,13 +28,14 @@ describe('BatchImportDialog', () => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('uses the shared two-step flow and submits a validated XLSX file', async () => {
|
||||
it.each([false, true])('uses the shared two-step flow and submits a validated XLSX file (dense: %s)', async (dense) => {
|
||||
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
|
||||
const result: BatchImportResult = {
|
||||
fileName: 'partners.xlsx', totalRows: 2, importedRows: 2, success: true, errors: [],
|
||||
}
|
||||
const importFile = vi.fn().mockResolvedValue(result)
|
||||
const wrapper = mount(BatchImportDialog, {
|
||||
attrs: { class: dense ? 'admin-density-dialog' : undefined },
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
modelValue: true,
|
||||
@@ -48,6 +49,7 @@ describe('BatchImportDialog', () => {
|
||||
})
|
||||
await flushPromises()
|
||||
|
||||
expect(document.querySelector('.batch-import-dialog')?.classList.contains('admin-density-dialog')).toBe(dense)
|
||||
expect(document.body.textContent).toContain('下载标准模板')
|
||||
expect(document.body.textContent).toContain('选择填写后的文件')
|
||||
expect(button('开始导入')?.hasAttribute('disabled')).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user