Skip to content

Commit d68efe0

Browse files
committed
Quantity component + cart test fixes
1 parent 97ab031 commit d68efe0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

resources/js/components/Product/QuantitySelect.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default {
7878
decreasable() {
7979
return this.value - this.step >= this.min
8080
},
81+
8182
value: {
8283
get() {
8384
return this.modelValue

resources/views/components/quantity.blade.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<button
99
v-on:click.prevent="qtySelect.decrease"
1010
v-bind:disabled="!qtySelect.decreasable"
11+
disabled
1112
aria-label="@lang('Decrease')"
1213
class="shrink-0 pl-2.5 text disabled:cursor-not-allowed disabled:opacity-50"
1314
>
@@ -17,15 +18,10 @@ class="shrink-0 pl-2.5 text disabled:cursor-not-allowed disabled:opacity-50"
1718
name="qty"
1819
type="number"
1920
data-testid="qty"
21+
value="1"
2022
class="outline-0 ring-0 border-none w-12 bg-transparent font-medium text-center px-0 sm:text-base focus:ring-transparent arrows-hidden"
2123
aria-label="@lang('Quantity')"
22-
ref="input"
23-
:min="qtySelect.min"
24-
:max="qtySelect.max > 0 ? qtySelect.max : null"
25-
:step="qtySelect.step"
26-
v-model="qtySelect.value"
2724
{{ $attributes }}
28-
v-bind="$attrs"
2925
/>
3026
<button
3127
v-on:click.prevent="qtySelect.increase"

tests/playwright/cart.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ test('change quantity', BasePage.tags, async ({ page }) => {
1818
const product = await new ProductPage(page).addToCart(process.env.PRODUCT_URL_SIMPLE)
1919
// TODO: Extract to CartPage?
2020
await page.goto('/cart')
21+
await page.waitForLoadState('networkidle')
2122
await page.getByTestId('qty').fill('5')
2223
await page.getByTestId('qty').press('Tab')
2324
await expect(page.getByTestId('cart-item')).toContainText((product.price * 5).toString())

0 commit comments

Comments
 (0)