title: TypeError: Cannot read property 'dispatchEvent' of null
body: <p>A written emit method test case in Angular now facing an issue is TypeError: Cannot read property 'dispatchEvent' of null.</p>
  
  <p>Get the click event end call to emit method.
  child component Html file</p>
  
  <p>article.html</p>
  
  <pre><code>&lt;a (click)="edit(item)" class="mat-card-title" style="cursor: pointer"&gt;{{ item.title }}&lt;/a&gt;
  </code></pre>
  
  <p>viewArticle.spec.ts</p>
  
  <pre><code> fit('emiter call', () =&gt; {
      const fixture2 = TestBed.createComponent(ArticleCarouselComponent);
      const component2 = fixture2.componentInstance;
      spyOn(component2.changeevent, 'emit');
      const nativeElement = fixture.nativeElement;
      const button = nativeElement.querySelector('a');
      button.dispatchEvent(new Event('click'));
      fixture.detectChanges();
      expect(component2.changeevent.emit).toHaveBeenCalled();
    });
  </code></pre>
  
  <p>TypeError: Cannot read property 'dispatchEvent' of null</p>