Skip to content
Snippets Groups Projects
Commit 7a5aa179 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6129 Refactor test for event emitter in search result item

parent cb22c094
No related branches found
No related tags found
No related merge requests found
import { getElementFromFixture } from '@alfa-client/test-utils';
import { getElementFromFixture, mock } from '@alfa-client/test-utils';
import { EventEmitter } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { SearchResultItemComponent } from './search-result-item.component';
......@@ -22,14 +23,14 @@ describe('SearchResultItemComponent', () => {
expect(component).toBeTruthy();
});
describe('clickItem', () => {
describe('itemClicked', () => {
it('should emit event', () => {
component.itemClicked = <any>mock(EventEmitter);
const button = getElementFromFixture(fixture, getDataTestIdOf('item-button'));
const emitSpy = jest.spyOn(component.itemClicked, 'emit');
button.click();
expect(emitSpy).toHaveBeenCalled();
expect(component.itemClicked.emit).toHaveBeenCalled();
});
});
......
......@@ -13,7 +13,7 @@ import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@
]"
role="listitem"
tabindex="-1"
(click)="clickItem.emit()"
(click)="itemClicked.emit()"
data-test-id="item-button"
#button
>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment