Skip to content

Commit

Permalink
fix(select): incorrect search value if mode-value is not nil
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed Dec 29, 2023
1 parent 16d37dd commit 2be167f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const autocompleteInputValueComputed = computed({
onMounted(() => {
if (props.multiple) { return }
if (!props.autocomplete) { return }
autocompleteInputValueComputed.value = props.valueString as string
})
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/va-select/hooks/useAutocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const useAutocomplete = (
})

watch(autocompleteValue, (newValue) => {
if (!props.autocomplete) { return }

if (newValue && newValue !== getLastOptionText(value.value)) {
dropdownShown.value = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('VaSelect', () => {
wrapper.vm.showDropdownContentComputed = true
await wrapper.vm.$nextTick()
const dropdownContent = wrapper.getComponent(VaDropdownContent)
expect(dropdownContent.find('.va-select-option--selected').text()).toBe(`${options[1].label} check`)
expect(dropdownContent.find('.va-select-option--selected').text()).toBe(`${options[1].label} check`)
expect(wrapper.find('.va-input-wrapper__text').text()).toBe(String(options[1].label))
})

Expand Down

0 comments on commit 2be167f

Please sign in to comment.