This commit is contained in:
2026-10-30 11:19:57 +08:00
parent a2ef3542f4
commit 8cc8b4fb94
13 changed files with 218 additions and 74 deletions
@@ -68,6 +68,19 @@ beforeEach(() => {
afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals(); document.body.innerHTML = '' })
describe('单据费用操作', () => {
it('resets a previous bill selection to wallet when switching to procurement', async () => {
const wrapper = mount(OverseasFeeEditor, { props: { modelValue: false, fee: null, items: [] }, attachTo: document.body, global: { plugins: [ElementPlus, createPinia()] } })
await wrapper.setProps({ modelValue: true }); await flushPromises()
const dialog = activeDialog(wrapper)
const form = dialog.getComponent({ name: 'ElForm' }).props('model')
form.settlementMode = 'BILL'
const typeSelect = dialog.findAllComponents({ name: 'ElSelect' })[0]!
typeSelect.vm.$emit('update:modelValue', 'OVERSEAS_PROCUREMENT')
typeSelect.vm.$emit('change', 'OVERSEAS_PROCUREMENT')
await flushPromises()
expect(form.settlementMode).toBe('WALLET')
expect(api.createOverseasFee).not.toHaveBeenCalled()
})
it('uses the same fee dialog for procurement with balance deduction selected by default', async () => {
vi.mocked(api.listBusinessOverseasFees).mockResolvedValue({ records: [], total: 0, page: 1, size: 20, pages: 0 })
const procurement = { ...business, businessType: 'OVERSEAS_PROCUREMENT', businessNo: 'OP-1' }