AutoComplete: show overlay if there are no suggestions (#3866)
* fix(autocomplete): show overlay if there are no suggestions * test(autocomplete): show overlay if there are no suggestions * chore: formattingpull/4142/head
parent
1695365111
commit
07e9773db7
|
@ -55,6 +55,21 @@ describe('AutoComplete.vue', () => {
|
|||
expect(wrapper.findAll('.p-autocomplete-item').length).toBe(1);
|
||||
});
|
||||
|
||||
it('should show overlay and empty-message if there are no suggestions', async () => {
|
||||
const event = { target: { value: 'b' } };
|
||||
|
||||
wrapper.vm.search(event, event.target.value, 'input');
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
await wrapper.setProps({
|
||||
suggestions: []
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-autocomplete-items').exists()).toBe(true);
|
||||
expect(wrapper.findAll('.p-autocomplete-item').length).toBe(0);
|
||||
expect(wrapper.find('.p-autocomplete-empty-message').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('dropdown', () => {
|
||||
it('should have correct custom icon', async () => {
|
||||
wrapper.setProps({
|
||||
|
|
|
@ -215,7 +215,7 @@ export default {
|
|||
},
|
||||
suggestions() {
|
||||
if (this.searching) {
|
||||
ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : !!this.$slots.empty ? this.show() : this.hide();
|
||||
this.show();
|
||||
this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
||||
this.searching = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue