feat: refactor services injection in search and store home components, add direct purchase event tests

This commit is contained in:
2026-07-27 16:26:03 -03:00
parent f063bac527
commit 4f1405f6c1
6 changed files with 61 additions and 22 deletions

View File

@@ -1,4 +1,6 @@
<div class="product-row-card border rounded bg-white shadow-sm d-flex justify-content-between p-3 gap-3">
<div
class="product-row-card border rounded bg-white shadow-sm d-flex justify-content-between p-3 gap-3"
>
<!-- Left Side: Title and Description -->
<div class="product-row-card__info d-flex flex-column justify-content-center flex-grow-1">
<h3 class="product-row-card__title text-uppercase mb-1 m-0">
@@ -19,9 +21,7 @@
{{ formattedPrice() }}
</span>
<div class="product-row-card__btn-wrapper">
<app-button variant="primary" (click)="onBuy()">
Comprar
</app-button>
<app-button variant="primary" (click)="onBuy()"> Comprar </app-button>
</div>
</div>
@@ -35,12 +35,10 @@
</select>
}
<app-quantity-selector [(quantity)]="quantity" ></app-quantity-selector>
<app-quantity-selector [(quantity)]="quantity"></app-quantity-selector>
<div class="product-row-card__btn-wrapper">
<app-button variant="secondary" (click)="onAddToCart()">
Agregar al carrito
</app-button>
<app-button variant="secondary" (click)="onAddToCart()"> Agregar al carrito </app-button>
</div>
</div>
</div>

View File

@@ -1,4 +1,12 @@
import { ChangeDetectionStrategy, Component, computed, effect, input, output, model } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
computed,
effect,
input,
output,
model,
} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ButtonComponent } from '../button/button.component';
import { QuantitySelectorComponent } from '../quantity-selector/quantity-selector.component';
@@ -53,7 +61,7 @@ export class ProductRowCardComponent {
protected onAddToCart(): void {
this.addToCart.emit({
quantity: this.quantity(),
variant: this.selectedVariant()
variant: this.selectedVariant(),
});
}