'Angular 13 how to Test ComponentInstance for NgbModal
im working on Angular project , in my AppComponent i have a method that open Modal ( the content of this modal is an other angular componant) this is my code :
openSearchEntreprisePopup() : void {
const confirmModal = this.modalService.open(SearchEntrepriseComponent);
confirmModal.componentInstance.title = 'Garant';
// subscribe to value from eventEmitter
confirmModal.componentInstance.myEvent.subscribe((response: string) => {
this.myform.get('garant').setValue(response);
confirmModal.close();
});
}
my issue is tha i want to make a unit test that allows me to test the result of my SearchEntrepriseComponent Event and subscribe to it in order to get the value
and set it to my form
and check if confirmModal.close() is called .
this is my test code :
it('#openSearchEntreprisePopup', () => {
component.openSearchEntreprisePopup();
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
