Skip to content

Commit

Permalink
fix: fix: implemeted emit in add and remove method
Browse files Browse the repository at this point in the history
  • Loading branch information
DominMFD committed Feb 27, 2024
1 parent 9ec4fbc commit d42d66c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Dropdown.prototype = Object.assign(Dropdown.prototype, Component.prototype, {
listItem.textContent = object.label;
listItem.setAttribute('data-value', object.value);
listItem.classList.add('dropdown-option');
return this.selected.get('dropdown-options').appendChild(listItem);
this.emit('add', this.selected.get('dropdown-options').appendChild(listItem));
},
removeItem(object) {
const itemToRemove = this.selected
Expand All @@ -65,7 +65,10 @@ Dropdown.prototype = Object.assign(Dropdown.prototype, Component.prototype, {
if (!itemToRemove) {
throw new Error('Object not found');
}
return this.selected.get('dropdown-options').removeChild(itemToRemove);
this.emit(
'remove',
this.selected.get('dropdown-options').removeChild(itemToRemove),
);
},
select(selected) {
this.selected.get('dropdown-selected').textContent = selected.textContent;
Expand Down

0 comments on commit d42d66c

Please sign in to comment.