diff --git a/projects/ion/src/lib/input-select/input-select.component.spec.ts b/projects/ion/src/lib/input-select/input-select.component.spec.ts index 48d2547c2..065896b7e 100644 --- a/projects/ion/src/lib/input-select/input-select.component.spec.ts +++ b/projects/ion/src/lib/input-select/input-select.component.spec.ts @@ -179,6 +179,26 @@ describe('IonInputSelectComponent', () => { expect(valueChange).toHaveBeenCalledWith(valueToEmmit); }); + + it('should emit the event when another option is selected', async () => { + await sut({ + name: 'test', + valueChange: { emit: valueChange } as SafeAny, + }); + + valueToEmmit = { + optionSelected: { + label: 'Igual a', + selected: true, + }, + firstValue: '', + secondValue: '', + }; + + selectSecondOption(); + + expect(valueChange).toHaveBeenCalledWith(valueToEmmit); + }); }); describe('IonInputSelectComponent - Default options', () => { diff --git a/projects/ion/src/lib/input-select/input-select.component.ts b/projects/ion/src/lib/input-select/input-select.component.ts index 0a49e39e9..c5eb8437e 100644 --- a/projects/ion/src/lib/input-select/input-select.component.ts +++ b/projects/ion/src/lib/input-select/input-select.component.ts @@ -45,6 +45,11 @@ export class IonInputSelectComponent implements OnInit { this.clearInputs(); this.currentOption = selectedOption[0]; this.toggleDropdownVisibility(); + this.valueChange.emit({ + optionSelected: this.currentOption, + firstValue: this.value, + secondValue: this.secondValue, + }); } public handleClick(): void {