All files / src/app/extensions/wishlists/shared/wishlists-link wishlists-link.component.ts

90% Statements 9/10
50% Branches 3/6
66.66% Functions 2/3
100% Lines 9/9

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 281x   1x   1x   1x                 1x 1x       1x     1x 1x      
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
 
import { GenerateLazyComponent } from 'ish-core/utils/module-loader/generate-lazy-component.decorator';
 
import { WishlistsFacade } from '../../facades/wishlists.facade';
import { Wishlist } from '../../models/wishlist/wishlist.model';
 
@Component({
  selector: 'ish-wishlists-link',
  templateUrl: './wishlists-link.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
@GenerateLazyComponent()
export class WishlistsLinkComponent implements OnInit {
  @Input() view: 'auto' | 'small' | 'full' = 'auto';
  preferredWishlist$: Observable<Wishlist>;
  routerLink$: Observable<string>;
 
  constructor(private wishlistFacade: WishlistsFacade) {}
 
  ngOnInit() {
    this.preferredWishlist$ = this.wishlistFacade.preferredWishlist$;
    this.routerLink$ = this.preferredWishlist$.pipe(map(pref => `/account/wishlists${pref ? `/${pref.id}` : '/'}`));
  }
}