Maybe I'll start with what I want to achieve: I have a form with a required field. By default it should not display any error. The error should be displayed if a user touches the field. So my field looks more or less like this:
<ion-input .... (ionBlur)="updateDispayedErrors()"></ion-input>
But I don't know how to test it because:
- Running
fixture.debugElement.nativeElement.blur()
does not triggersionBlur
handler (the same with....dispatchEvent(new Event('blur'))
) - Plain angular
(blur)
does not work (i.e. if I change the code to(blur)="updateDisplayErrors()"
then it does not work) - It seems that calling
blur()
method on native<input .../>
element that is created in the browser would work but... the problem is that when I run the testsfixture.debugElement.nativeElement.childNodes
is empty... So the native<input .../>
is not created
Please let me know if you would like to see a full example to illustrate it.