Skip to content
Snippets Groups Projects
Commit 5412fa7a authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6129 improve test

parent b01b82e3
No related branches found
No related tags found
No related merge requests found
...@@ -568,11 +568,21 @@ describe('InstantSearchComponent', () => { ...@@ -568,11 +568,21 @@ describe('InstantSearchComponent', () => {
}); });
describe('onItemClicked', () => { describe('onItemClicked', () => {
beforeEach(() => {
component.hideResults = jest.fn();
});
it('should emit searchResultSelected', () => { it('should emit searchResultSelected', () => {
component.onItemClicked(searchResults[0], 0); component.onItemClicked(searchResults[0], 0);
expect(searchResultSelected.emit).toHaveBeenCalledWith(searchResults[0]); expect(searchResultSelected.emit).toHaveBeenCalledWith(searchResults[0]);
}); });
it('should hide results', () => {
component.onItemClicked(searchResults[0], 0);
expect(component.hideResults).toHaveBeenCalled();
});
}); });
describe('onClickHandler', () => { describe('onClickHandler', () => {
......
...@@ -219,5 +219,6 @@ export class InstantSearchComponent implements OnInit, OnDestroy { ...@@ -219,5 +219,6 @@ export class InstantSearchComponent implements OnInit, OnDestroy {
onItemClicked(searchResult: InstantSearchResult<unknown>, index: number) { onItemClicked(searchResult: InstantSearchResult<unknown>, index: number) {
this.searchResultSelected.emit(searchResult); this.searchResultSelected.emit(searchResult);
this.focusedResult = index; this.focusedResult = index;
this.hideResults();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment