Test that event handler is called when file input receives data
Is there another way to manually assign the value of the input field
You can't assign value to input[type="file"]
due to security reasons.
or at least get it to send an event that is handled by fileChange
You can fire change
event after spyOn
:
spyOn(component, 'fileChange');
input.dispatchEvent(new Event('change'));
expect(component.fileChange).toHaveBeenCalled();
Plunker Example