Skip to content

Commit

Permalink
fix: display error messages on empty cart
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Haehnlein authored and SGrueber committed Dec 9, 2019
1 parent 3547cef commit 0d75e7c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/pages/basket/basket-page.container.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
</ng-container>
</ng-container>

<ng-template #emptyBasket> <ish-shopping-basket-empty></ish-shopping-basket-empty> </ng-template>
<ng-template #emptyBasket>
<ish-shopping-basket-empty [error]="basketError$ | async"></ish-shopping-basket-empty>
</ng-template>

<ish-loading *ngIf="basketLoading$ | async"></ish-loading>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div class="empty-cart">
<div>
<!-- Error message -->
<ish-error-message [error]="error"></ish-error-message>
</div>

<img
class="empty-cart-icon"
src="assets/img/checkout/empty-cart.png"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { MockComponent } from 'ng-mocks';

import { ErrorMessageComponent } from 'ish-shared/common/components/error-message/error-message.component';

import { ShoppingBasketEmptyComponent } from './shopping-basket-empty.component';

Expand All @@ -10,7 +13,7 @@ describe('Shopping Basket Empty Component', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ShoppingBasketEmptyComponent],
declarations: [MockComponent(ErrorMessageComponent), ShoppingBasketEmptyComponent],
imports: [TranslateModule.forRoot()],
}).compileComponents();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';

import { HttpError } from 'ish-core/models/http-error/http-error.model';

@Component({
selector: 'ish-shopping-basket-empty',
templateUrl: './shopping-basket-empty.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ShoppingBasketEmptyComponent {}
export class ShoppingBasketEmptyComponent {
@Input() error: HttpError;
}

0 comments on commit 0d75e7c

Please sign in to comment.