fix: close admin settings review gaps

This commit is contained in:
IanShaw027
2026-04-21 00:41:29 +08:00
parent 55e8dd550a
commit 030da8c2f6
8 changed files with 110 additions and 14 deletions

View File

@@ -449,4 +449,27 @@ describe('admin SettingsView payment visible method controls', () => {
})
)
})
it('blocks saving when a visible payment method is enabled without a source', async () => {
const wrapper = mountView()
await flushPromises()
await openPaymentTab(wrapper)
const paymentSourceSelects = wrapper
.findAll('select.select-stub')
.filter((node) => ['alipay', 'wxpay'].includes(node.attributes('data-placeholder')))
const alipaySelect = paymentSourceSelects.find(
(node) => node.attributes('data-placeholder') === 'alipay'
)
await alipaySelect?.setValue('')
await wrapper.find('form').trigger('submit.prevent')
await flushPromises()
expect(updateSettings).not.toHaveBeenCalled()
expect(showError).toHaveBeenCalled()
expect(String(showError.mock.calls.at(-1)?.[0] ?? '')).toContain('支付来源')
})
})