darrenjennings / vue-autosuggest

🔍 Vue autosuggest component.
https://darrenjennings.github.io/vue-autosuggest
MIT License
621 stars 91 forks source link

Trigger onSelected event from vue test #219

Open AleksandarKurta opened 2 years ago

AleksandarKurta commented 2 years ago

Hello,

Since autosuggest is rendering input field and for the result "ul" list with "li" this is not going to work

 const options = wrapper.find('#product').findAll('option')
 await options.at(1).setSelected() 

I tried to simulate the click on input filed and after that to click on "li" element

await wrapper.find("#product").trigger("click");
await wrapper.findAll(".autosuggest__results-item").at(1).trigger("selected");

but it doesn't triggers @selected="onSelected"

Can anyone help?