All files / src/app/extensions/wishlists/shared/wishlist-line-item wishlist-line-item.component.ts

77.77% Statements 7/9
100% Branches 0/0
33.33% Functions 1/3
75% Lines 6/8

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 321x   1x                       1x 1x       1x   1x                    
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
 
import { WishlistsFacade } from '../../facades/wishlists.facade';
import { Wishlist, WishlistItem } from '../../models/wishlist/wishlist.model';
 
/**
 * The Wishlist item component displays a wishlist item. This Item can be removed or moved to another wishlist.
 */
@Component({
  selector: 'ish-wishlist-line-item',
  standalone: false,
  templateUrl: './wishlist-line-item.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WishlistLineItemComponent {
  constructor(private wishlistsFacade: WishlistsFacade) {}
 
  @Input({ required: true }) wishlistItemData: WishlistItem;
  @Input({ required: true }) currentWishlist: Wishlist;
  @Input() readOnly = false;
 
  @Output() readonly moveClicked = new EventEmitter<string>();
 
  emitMoveClicked() {
    this.moveClicked.emit(this.wishlistItemData.id);
  }
 
  removeProductFromWishlist(sku: string) {
    this.wishlistsFacade.removeProductFromWishlist(this.currentWishlist.id, sku);
  }
}