Skip to content

Commit

Permalink
feat: add a link to order details page for registered users on checko…
Browse files Browse the repository at this point in the history
…ut receipt page (#216)
  • Loading branch information
SGrueber authored and shauke committed May 18, 2020
1 parent 6931e3f commit 64b0056
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ <h1 class="d-flex flex-wrap align-items-baseline">
<div class="section">
<p>
<span>{{ 'checkout.order.number.label' | translate }}</span>
<strong data-testing-id="order-document-number"> {{ order.documentNo }}</strong>
<strong data-testing-id="order-document-number">
<a *ngIf="user; else plainOrderNo" [routerLink]="'/account/orders/' + order.id"> {{ order.documentNo }}</a>
<ng-template #plainOrderNo> {{ order.documentNo }}</ng-template>
</strong>
</p>
<p [innerHTML]="'checkout.receipt.notification.mail.text' | translate: { '0': order.invoiceToAddress.email }"></p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
import { MockComponent } from 'ng-mocks';

Expand Down Expand Up @@ -29,7 +30,7 @@ describe('Checkout Receipt Component', () => {
MockComponent(LineItemListComponent),
MockComponent(ModalDialogLinkComponent),
],
imports: [TranslateModule.forRoot()],
imports: [RouterTestingModule, TranslateModule.forRoot()],
}).compileComponents();
}));

Expand All @@ -49,7 +50,7 @@ describe('Checkout Receipt Component', () => {

it('should display the document number after creation', () => {
fixture.detectChanges();
expect(element.querySelector('[data-testing-id="order-document-number"]').innerHTML.trim()).toEqual('12345678');
expect(element.querySelector('[data-testing-id="order-document-number"]').innerHTML.trim()).toContain('12345678');
});

it('should display the home link after creation', () => {
Expand Down

0 comments on commit 64b0056

Please sign in to comment.