title: How to trigger an event in angular app for unit testing?
body: <p>I am running unit test in angular, I want to trigger a click event, this is a drop down upon clicking it drops down a list of Customer numbers. I want to trigger this event in my unit test, if this event is successfully triggered, I can update the customer info corresponding to index of clicked button. I have attached necessary code for reference. Please let me know how to trigger click event?</p>
  
  <pre><code>//template.html 
  &lt;mat-menu #menuFilter="matMenu"&gt;
      &lt;button *ngFor="let customer of customers; let i = index" (click)="onCustomerChange(i)" mat-menu-item class="selectCustomerData"&gt;{{customer.licenseownerid}}&lt;/button&gt;
   &lt;/mat-menu&gt;
  </code></pre>
  
  <pre><code>//angular generated code
  &lt;div class="mat-menu-panel ng-trigger ng-trigger-transformMenu ng-tns-c10-1 mat-menu-after
   mat-menu-below ng-star-inserted mat-elevation-z2" role="menu" tabindex="-1" ng-reflect-klass="mat-menu-panel" 
   ng-reflect-ng-class="[object Object]" style="transform-origin: left top;"&gt;
      &lt;div class="mat-menu-content"&gt;
            &lt;button class="selectCustomerData mat-menu-item ng-star-inserted" mat-menu-item="" role="menuitem" tabindex="0" aria-disabled="false"&gt;0LPT_id0306
              &lt;div class="mat-menu-ripple mat-ripple" matripple="" ng-reflect-disabled="false" ng-reflect-trigger="[object HTMLButtonElement]"&gt;
              &lt;/div&gt;
            &lt;/button&gt;
            &lt;button class="selectCustomerData mat-menu-item ng-star-inserted" mat-menu-item="" role="menuitem" tabindex="0" aria-disabled="false"&gt;0LPT_id03061
             &lt;div class="mat-menu-ripple mat-ripple" matripple="" ng-reflect-disabled="false" ng-reflect-trigger="[object HTMLButtonElement]"&gt;
             &lt;/div&gt;
            &lt;/button&gt;
         &lt;/div&gt;
  ...and so on
  &lt;/div&gt;
  </code></pre>
  
  <pre><code>//component.ts
   onCustomerChange(i) {
      this.customerNumber = this.customers[i].licenseownerid;
      this.customerName = this.customers[i].licenseownername;
  }
  </code></pre>