test(components): [select] add case for disabled and automatic-dropdown (#18112)

This commit is contained in:
wzc520pyfm 2024-09-01 08:02:55 +08:00 committed by GitHub
parent f365724f77
commit c90ebf8ca4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2751,4 +2751,32 @@ describe('Select', () => {
await (vm.multiple = false)
expect(vm.value).toBe(undefined)
})
// case #18022
it('should be do not expend options when select is disabled', async () => {
const value = null
const wrapper = _mount(
`
<el-select v-model="value"
filterable
automatic-dropdown
disabled
>
<el-option value="1">1</el-option>
<el-option value="2">2</el-option>
</el-option>
</el-select>
`,
() => ({
value,
})
)
await nextTick()
await wrapper.find(`.${WRAPPER_CLASS_NAME}`).trigger('focus')
await nextTick()
expect(
(document.querySelector('.el-select__popper') as HTMLElement).style
.display
).toBe('none')
})
})