All files / src/app/shared/components/search/suggest-categories-tile suggest-categories-tile.component.ts

92.3% Statements 12/13
75% Branches 3/4
66.66% Functions 2/3
92.3% Lines 12/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 356x 6x 6x 6x   6x   6x 6x                 6x   2x 2x       2x     2x              
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { RouterModule } from '@angular/router';
import { Observable, ReplaySubject } from 'rxjs';
 
import { ShoppingFacade } from 'ish-core/facades/shopping.facade';
import { CategoryView } from 'ish-core/models/category-view/category-view.model';
import { PipesModule } from 'ish-core/pipes.module';
import { CategoryImageComponent } from 'ish-shared/components/category/category-image/category-image.component';
 
@Component({
  selector: 'ish-suggest-categories-tile',
  templateUrl: './suggest-categories-tile.component.html',
  standalone: true,
  imports: [CommonModule, PipesModule, RouterModule, CategoryImageComponent],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SuggestCategoriesTileComponent implements OnInit {
  @Input({ required: true }) categoryUniqueId: string;
  @Input() inputTerms$ = new ReplaySubject<string>(1);
  @Output() routeChange = new EventEmitter<void>();
 
  category$: Observable<CategoryView>;
 
  constructor(private shoppingFacade: ShoppingFacade) {}
 
  ngOnInit() {
    this.category$ = this.shoppingFacade.category$(this.categoryUniqueId);
  }
 
  handleInputFocus(): void {
    this.routeChange.emit();
  }
}