20260914172820
This commit is contained in:
1 parent
c31329d387
commit
549c8bd2eb
38 files changed
+3430
-502
No files matched your search
@@ -37,6 +37,7 @@ describe('FmsField 类型 → 控件映射', () => {
|
||||
['select', '.select-trigger'],
|
||||
['date', '.fms-date-picker'],
|
||||
['datetime', '.fms-date-picker'],
|
||||
['range', '.fms-range-picker'],
|
||||
])('type=%s 渲染对应控件(%s)', (type, selector) => {
|
||||
const wrapper = mount(FmsField, { props: { type } })
|
||||
expect(wrapper.find(selector).exists()).toBe(true)
|
||||
@@ -72,6 +73,32 @@ describe('FmsField 值绑定', () => {
|
||||
expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual([1])
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('select multiple:选项切换抛出数组并保持下拉打开', async () => {
|
||||
const wrapper = mount(FmsField, {
|
||||
props: {
|
||||
type: 'select',
|
||||
modelValue: ['a'],
|
||||
controlProps: {
|
||||
multiple: true,
|
||||
options: [
|
||||
{ label: '甲', value: 'a' },
|
||||
{ label: '乙', value: 'b' },
|
||||
],
|
||||
},
|
||||
},
|
||||
attachTo: document.body,
|
||||
})
|
||||
await wrapper.find('.select-trigger').trigger('click')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const options = document.body.querySelectorAll('.select-option')
|
||||
options[1].click()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual([['a', 'b']])
|
||||
expect(document.body.querySelector('.select-option')).not.toBeNull()
|
||||
wrapper.unmount()
|
||||
})
|
||||
})
|
||||
|
||||
describe('FmsField 扩展口子', () => {
|
||||
|
||||
Reference in new issue
Block a user