I have an input field.
<input id-"search-text" (input)="search()">
unit test as follows.
it('search ', fakeAsync(() => {
spyOn(component, "search").and.callThrough();
let input = fixture.debugElement.query(By.css('#search-text'));
let el = input.nativeElement;
el.value = 'Fake One';
el.dispatchEvent(new Event('#search-text'));
expect(component.search).toHaveBeenCalled();
flush()
}));
I was trying to call function search while the input field got triggered. But am getting error as
Expected spy search to have been called.