Skip to content

Commit

Permalink
fix:remove code to populate cart id to spartacus storefront(#18920) (#…
Browse files Browse the repository at this point in the history
…18920)

Co-authored-by: I746264 <[email protected]>
Co-authored-by: Scar Ai <[email protected]>
  • Loading branch information
3 people authored Jun 6, 2024
1 parent 7698fa2 commit 9739878
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
formcontrolname="cartNumber"
[formControl]="cartId"
(keydown.enter)="bindCartToCustomer()"
(blur)="resetInput()"
[attr.aria-label]="'asm.bindCart.enterCartId' | cxTranslate"
/>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ describe('AsmBindCartComponent', () => {
spyOn(featureConfig, 'isLevel').and.returnValue(true);
});

it('should fill the cart field with the current active cart for the customer', () => {
fixture.detectChanges();

expect(component.cartId.value).toEqual(prevActiveCartId);
});

it('should leave the cart field blank when there is no current active cart for the customer', () => {
(activeCartFacade.getActiveCartId as jasmine.Spy).and.returnValue(of(''));

Expand All @@ -227,16 +221,6 @@ describe('AsmBindCartComponent', () => {
expect(component.cartId.value).toEqual('');
});

it('should reset the input with the active cart ID when left empty', () => {
fixture.detectChanges();
let input = fixture.debugElement.query(By.css('input'));

component.cartId.setValue('');
input.triggerEventHandler('blur');

expect(component.cartId.value).toEqual(prevActiveCartId);
});

it('should clear field when clear input is clicked', () => {
fixture.detectChanges();
let button = fixture.debugElement.query(By.css('.cx-asm-reset'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,10 @@ export class AsmBindCartComponent implements OnInit, OnDestroy {
this.subscription.add(
this.activeCartFacade.getActiveCartId().subscribe((response) => {
this.activeCartId = response ?? '';
this.cartId.setValue(this.deepLinkCartId || this.activeCartId);
})
);
}

resetInput() {
if (!this.cartId.value) {
this.cartId.setValue(this.activeCartId);
}
}

/**
* Bind the input cart number to the customer
*/
Expand Down Expand Up @@ -292,7 +285,9 @@ export class AsmBindCartComponent implements OnInit, OnDestroy {
this.deepLinkCartId = this.asmComponentService?.getSearchParameter(
'cartId'
) as string;
this.cartId.setValue(this.deepLinkCartId);
if (cartType === 'inactive') {
this.cartId.setValue(this.deepLinkCartId);
}
this.asmComponentService?.setShowDeeplinkCartInfoAlert(true);
this.asmComponentService?.handleDeepLinkNavigation();
}
Expand Down

0 comments on commit 9739878

Please sign in to comment.