Skip to content

Commit

Permalink
fix(vue-autocomplete): trigger change event on every click
Browse files Browse the repository at this point in the history
fixes #135
  • Loading branch information
Johannes Werner committed May 25, 2018
1 parent c6d19fe commit 54f3797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('VueAutocomplete.vue', () => {
expect(wrapper.emitted().change).toHaveLength(1);

wrapper.vm.onOptionClick(1);
expect(wrapper.emitted().change).toHaveLength(1);
expect(wrapper.emitted().change).toHaveLength(2);

wrapper.vm.searchQuery = 'Test';
wrapper.vm.onOptionClick(1);
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/components/VueAutocomplete/VueAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@
triggerChange(option: IAutocompleteOption) {
this.searchQuery = option.label;
this.$emit('change', option);
if (this.isSameSearchQuery()) {
return;
}
this.$emit('change', option);
this.previousQuery = this.searchQuery;
this.isOpen = false;
},
Expand Down

0 comments on commit 54f3797

Please sign in to comment.