diff --git a/src/app/core/layout/store-layout/store-layout.component.html b/src/app/core/layout/store-layout/store-layout.component.html
index ca7f51b..02638fd 100644
--- a/src/app/core/layout/store-layout/store-layout.component.html
+++ b/src/app/core/layout/store-layout/store-layout.component.html
@@ -18,8 +18,8 @@
[backgroundColor]="'#ffffff'"
(closed)="isCartOpen.set(false)"
>
- Seguir comprando
- Comprar
+ Seguir comprando
+ Comprar
}
diff --git a/src/app/core/layout/store-layout/store-layout.component.spec.ts b/src/app/core/layout/store-layout/store-layout.component.spec.ts
index f9da325..1fcd54a 100644
--- a/src/app/core/layout/store-layout/store-layout.component.spec.ts
+++ b/src/app/core/layout/store-layout/store-layout.component.spec.ts
@@ -146,4 +146,26 @@ describe('StoreLayoutComponent', () => {
expect(router.navigate).not.toHaveBeenCalled();
});
+
+ it('redirects to /checkout when cart buy button is clicked', () => {
+ const router = TestBed.inject(Router);
+ vi.spyOn(router, 'navigate');
+
+ const fixture = TestBed.createComponent(StoreLayoutComponent);
+ fixture.detectChanges();
+
+ fixture.componentInstance.isCartOpen.set(true);
+ fixture.detectChanges();
+
+ const compiled = fixture.nativeElement as HTMLElement;
+ const buyButton = Array.from(compiled.querySelectorAll('app-button button'))
+ .find((button) => button.textContent?.trim() === 'Comprar') as HTMLButtonElement | undefined;
+
+ expect(buyButton).toBeDefined();
+ buyButton!.click();
+ fixture.detectChanges();
+
+ expect(router.navigate).toHaveBeenCalledWith(['/checkout']);
+ expect(fixture.componentInstance.isCartOpen()).toBe(false);
+ });
});
diff --git a/src/app/core/layout/store-layout/store-layout.component.ts b/src/app/core/layout/store-layout/store-layout.component.ts
index 6c56df4..147a488 100644
--- a/src/app/core/layout/store-layout/store-layout.component.ts
+++ b/src/app/core/layout/store-layout/store-layout.component.ts
@@ -89,6 +89,11 @@ export class StoreLayoutComponent implements OnInit {
}
}
+ protected onCheckoutClick(): void {
+ this.isCartOpen.set(false);
+ void this.router.navigate(['/checkout']);
+ }
+
protected readonly footerSections: StoreFooterSection[] = [
{