add test asserting add-to-cart button renders as submit
All checks were successful
deploy / deploy (push) Successful in 48s
All checks were successful
deploy / deploy (push) Successful in 48s
Checks the button is type="submit" inside the phx-submit form. This would have caught the :shop vs :live mode mismatch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c0427d6956
commit
6ee8a31716
@ -305,6 +305,12 @@ defmodule BerrypodWeb.Shop.ProductShowTest do
|
||||
end
|
||||
|
||||
describe "Add to cart" do
|
||||
test "add to basket button is a submit button inside the form", %{conn: conn, print: print} do
|
||||
{:ok, view, _html} = live(conn, ~p"/products/#{print.slug}")
|
||||
|
||||
assert has_element?(view, "form[phx-submit='add_to_cart'] button[type='submit']", "Add to basket")
|
||||
end
|
||||
|
||||
test "add to cart opens the cart drawer", %{conn: conn, print: print} do
|
||||
{:ok, view, _html} = live(conn, ~p"/products/#{print.slug}")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user