mirror of
https://github.com/element-plus/element-plus.git
synced 2025-04-06 16:30:35 +08:00
fix(components): [select-v2] empty value check error in inputRef (#19140)
* fix(components): [select-v2] empty value check error in inputRef * test(components): [select-v2] empty value check error in inputRef * fix: test case
This commit is contained in:
parent
866f45aaac
commit
e17ec9a8a8
@ -1371,6 +1371,31 @@ describe('Select', () => {
|
||||
expect(placeholder.text()).toBe('option_a')
|
||||
})
|
||||
|
||||
it('the scroll position of the dropdown should be correct when value is 0', async () => {
|
||||
const options = Array.from({ length: 1000 }).map((_, idx) => ({
|
||||
value: 999 - idx,
|
||||
label: `options ${999 - idx}`,
|
||||
}))
|
||||
const wrapper = createSelect({
|
||||
data() {
|
||||
return {
|
||||
value: 0,
|
||||
options,
|
||||
}
|
||||
},
|
||||
})
|
||||
await nextTick()
|
||||
await wrapper.find(`.${WRAPPER_CLASS_NAME}`).trigger('click')
|
||||
const optionsDoms = Array.from(
|
||||
document.querySelectorAll(`.${OPTION_ITEM_CLASS_NAME}`)
|
||||
)
|
||||
const result = optionsDoms.some((option) => {
|
||||
const text = option.textContent
|
||||
return text === 'options 0'
|
||||
})
|
||||
expect(result).toBeTruthy()
|
||||
})
|
||||
|
||||
it('emptyText error show', async () => {
|
||||
const wrapper = createSelect({
|
||||
data() {
|
||||
|
@ -330,7 +330,7 @@ const useSelect = (props: ISelectV2Props, emit: SelectEmitFn) => {
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
props.modelValue &&
|
||||
!isEmptyValue(props.modelValue) &&
|
||||
filteredOptionsValueMap.value.has(props.modelValue)
|
||||
) {
|
||||
const { index } = filteredOptionsValueMap.value.get(props.modelValue)
|
||||
|
Loading…
x
Reference in New Issue
Block a user