add quantity controls to cart drawer via shared CartHook
Move increment/decrement handlers from Cart LiveView into CartHook so they work from any page's drawer. Enable show_quantity_controls on the drawer's cart_item_row. Scope cart tests to #main-content to avoid duplicate button matches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,7 +68,7 @@ defmodule SimpleshopThemeWeb.ShopLive.CartTest do
|
||||
|
||||
html =
|
||||
view
|
||||
|> element("button[aria-label='Increase quantity of #{product.title}']")
|
||||
|> element("#main-content button[aria-label='Increase quantity of #{product.title}']")
|
||||
|> render_click()
|
||||
|
||||
assert html =~ "Quantity updated to 2"
|
||||
@@ -83,7 +83,7 @@ defmodule SimpleshopThemeWeb.ShopLive.CartTest do
|
||||
|
||||
html =
|
||||
view
|
||||
|> element("button[aria-label='Decrease quantity of #{product.title}']")
|
||||
|> element("#main-content button[aria-label='Decrease quantity of #{product.title}']")
|
||||
|> render_click()
|
||||
|
||||
assert html =~ "Your basket is empty"
|
||||
|
||||
Reference in New Issue
Block a user