All files / src/app/pages/category/category-tile category-tile.component.ts

100% Statements 5/5
75% Branches 3/4
100% Functions 2/2
100% Lines 5/5

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 332x     2x                             2x               2x     2x      
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
 
import { ShoppingFacade } from 'ish-core/facades/shopping.facade';
import { CategoryView } from 'ish-core/models/category-view/category-view.model';
 
/**
 * The Category Tile Component renders a category tile with the image of the
 * category using {@link CategoryImageComponent}.
 *
 * @example
 * <ish-category-tile [categoryUniqueId]="category"></ish-category-tile>
 */
@Component({
  selector: 'ish-category-tile',
  templateUrl: './category-tile.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CategoryTileComponent implements OnInit {
  /**
   * The Category to render a tile for
   */
  @Input({ required: true }) categoryUniqueId: string;
 
  category$: Observable<CategoryView>;
 
  constructor(private shoppingFacade: ShoppingFacade) {}
 
  ngOnInit() {
    this.category$ = this.shoppingFacade.category$(this.categoryUniqueId);
  }
}