Angular2 and testing EventEmitter
<p>I have a <a href="https://plnkr.co/edit/WuoPHiTEqZvECxmrZ6eX" rel="nofollow noreferrer">plunkr</a>, and been trying to figure out how to test the EventEmitter after having tried following some of the suggestions on the web without success. I would like to know how to test it by triggering a click of the button...so more of a component test. The code is within the <strong>voter.component.ts</strong> and <strong>voter.componet.spec.ts</strong> file. Any help with this would be greatly appreciated.</p>

<pre><code>it('should emit on up/down vote click', fakeAsync((): void =&gt; {
    let fixture: ComponentFixture = TestBed.createComponent(VoterComponent);
    let instance: VoterComponent = fixture.componentInstance;

    spyOn(instance.onVote, 'emit');
    let button = findElement(fixture, 'button:first-child');
    button.click();

    fixture.detectChanges();
    tick();

    expect(instance.onVote.emit).toHaveBeenCalled(1);
}));
</code></pre>