title: How test event html in jasmine angular
body: <p>I have some functions here in my project, but I decided to choose this one as an example. My function I want to test is this.</p>
  <pre><code>   &lt;mat-select
        *ngIf=&quot;name != '' &amp;&amp; formControl == undefined&quot;
        [placeholder]=&quot;placeholder&quot;
        [formControlName]=&quot;name&quot;
        [multiple]=&quot;multiple&quot;
        (selectionChange)=&quot;selectionChange($event)&quot;
     &gt;
     selectionChange = (event) =&gt; {
        let emit: any[] = [];
        if (this.multiple) {
           emit = this.selectOptions.filter((item) =&gt; {
              return event.value.find((item2) =&gt; item2 === item.value);
           });
        } else {
           emit = [this.selectOptions.find((item) =&gt; item.value === event.value)];
        }
        this.onSelectionChange.emit(emit.map((item) =&gt; item.original));
     };
  </code></pre>
  <p>And the function in jasmine using spies is like this, I wanted to call the selectionChange function passing the event as a parameter, but without success</p>
  <pre><code>  it('deverá chamar a função selectionChange', () =&gt; {
        
      let select = fixture.debugElement.query(By.css('.mat-select')).nativeElement;
     
      fixture.detectChanges();
  
      spyOn(component,'selectionChange').and.callThrough();
      component.selectionChange(select.event);
      expect(component.selectionChange).toHaveBeenCalled();
    });
  
  </code></pre>