All files / src/app/pages/basket/shopping-basket shopping-basket.component.ts

85.71% Statements 6/7
100% Branches 0/0
50% Functions 1/2
85.71% Lines 6/7

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 35 36 37 38 39 40 41 422x   2x 2x                                               2x     3x   3x                  
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
 
import { BasketView } from 'ish-core/models/basket/basket.model';
import { HttpError } from 'ish-core/models/http-error/http-error.model';
 
/**
 * The Shopping Basket Component displays the users basket items, cost summary
 * and promotion code input.
 * It provides update cart and add cart to quote functionality.
 * It is the starting point for the checkout workflow.
 *
 * It uses the {@link LineItemListComponent} for the rendering of line items.
 * It uses the {@link BasketCostSummaryComponent} to render the cost summary.
 * It uses the {@link BasketPromotionCodeComponent} to render the promotion code input.
 *
 * @example
 * <ish-shopping-basket
 *   [basket]="basket"
 *   [error]="basketError$ | async"
 *   (nextStep)="nextStep()"
 * ></ish-shopping-basket>
 */
@Component({
  selector: 'ish-shopping-basket',
  templateUrl: './shopping-basket.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ShoppingBasketComponent {
  @Input({ required: true }) basket: BasketView;
  @Input() error: HttpError;
  @Input() loading = false;
 
  @Output() nextStep = new EventEmitter<void>();
 
  /**
   * checkout button leads to checkout address page if basket is valid
   */
  checkout() {
    this.nextStep.emit();
  }
}