All files / src/app/shared/components/line-item/line-item-edit-dialog line-item-edit-dialog.component.ts

88.88% Statements 8/9
75% Branches 3/4
66.66% Functions 2/3
100% Lines 8/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 301x 1x   1x                       1x         4x     4x 4x   4x      
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable, map } from 'rxjs';
 
import { ProductContextFacade } from 'ish-core/facades/product-context.facade';
import { Price } from 'ish-core/models/price/price.model';
import { ProductView } from 'ish-core/models/product-view/product-view.model';
 
/**
 * The Line Item Edit Dialog Component displays an edit-dialog of a line items to edit quantity and variation.
 */
@Component({
  selector: 'ish-line-item-edit-dialog',
  templateUrl: './line-item-edit-dialog.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LineItemEditDialogComponent implements OnInit {
  variation$: Observable<ProductView>;
  variationSalePrice$: Observable<Price>;
  loading$: Observable<boolean>;
 
  constructor(private context: ProductContextFacade) {}
 
  ngOnInit() {
    this.variation$ = this.context.select('product');
    this.variationSalePrice$ = this.context.select('prices').pipe(map(prices => prices?.salePrice));
 
    this.loading$ = this.context.select('loading');
  }
}