Skip to content

Commit

Permalink
refactor: product selector memoization (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi authored Feb 23, 2021
1 parent b8ae40d commit ac0b35a
Show file tree
Hide file tree
Showing 161 changed files with 2,395 additions and 2,303 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class OrderTemplatesDetailsPage {
get listItemLink() {
return cy
.get('ish-account-order-template-detail-line-item')
.find('a[data-testing-id="order-template-product-link"]');
.find('[data-testing-id="order-template-product"] a[data-testing-id="product-name-link"]');
}

get OrderTemplateTitle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class WishlistsDetailsPage {
}

get listItemLinks() {
return this.listItems.find('a[data-testing-id="wishlist-product-link"]');
return this.listItems.find('[data-testing-id="wishlist-product"] a[data-testing-id="product-name-link"]');
}

get wishlistTitle() {
Expand Down
9 changes: 9 additions & 0 deletions src/app/core/directives/product-context.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class ProductContextDirective implements OnInit, OnChanges {
this.context.set('sku', () => sku);
}

@Input()
set categoryId(categoryId: string) {
this.context.set('categoryId', () => categoryId);
}

@Input()
set quantity(quantity: number) {
this.context.set('quantity', () => quantity);
Expand All @@ -44,6 +49,10 @@ export class ProductContextDirective implements OnInit, OnChanges {
@Input()
set parts(parts: SkuQuantityType[]) {
this.context.set('parts', () => parts);
this.context.set('displayProperties', () => ({
readOnly: true,
addToBasket: true,
}));
}

@Input()
Expand Down
Loading

0 comments on commit ac0b35a

Please sign in to comment.