I have the following component
<app-modal-default #confirmDelete>
<span class="title">Delete Confirmation</span>
<span class="modal-body-content">Do you want to delete all the data related to shipping, distribution and storage?
</span>
<div class="modal-actions">
<button class="btn btn-danger" (click)="confirmDeleteOk()">Delete</button>
<button class="btn-default btn" (click)="close(confirmDelete)">
Cancel
</button>
</div>
I have a view child declared in .ts file
@ViewChild('confirmDelete') confirmDelete: ModalDefaultComponent;
This view child iam closing in this function
confirmDeleteOk(): void {
this.hTstore$.dispatch(new fromHTAction.DeleteWMS());
this.close(this.confirmDelete);
}
This is my test file
it('Calling WMS delete through dispatch Action Should work as expected', fakeAsync((done) => {
component.confirmDeleteOk();
storeSpy.dispatch(new DeleteWMS());
expect(storeSpy.dispatch).toHaveBeenCalledWith(new DeleteWMS()); }));
TypeError: element.close is not a function
how to write test for view child for my element.close , how i can define element ?