berrypod/test/berrypod_web/live/shop/content_test.exs
jamey 7c07805df8
All checks were successful
deploy / deploy (push) Successful in 3m27s
add nav editors to Site tab with live preview
- Add header and footer nav editors to Site tab with drag-to-reorder,
  add/remove items, and destination picker (pages, collections, external)
- Live preview updates as you edit nav items
- Remove legacy /admin/navigation page and controller (was saving to
  Settings table, now uses nav_items table)
- Update error_html.ex and pages/editor.ex to load nav from nav_items table
- Update link_scanner to read from nav_items table, edit path now /?edit=site
- Add Site.default_header_nav/0 and default_footer_nav/0 for previews/errors
- Remove fallback logic from theme_hook.ex (database is now source of truth)
- Seed default nav items and social links during setup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-28 22:19:48 +00:00

97 lines
2.5 KiB
Elixir

defmodule BerrypodWeb.Shop.ContentTest do
use BerrypodWeb.ConnCase, async: false
import Phoenix.LiveViewTest
import Berrypod.AccountsFixtures
setup do
user_fixture()
{:ok, _} = Berrypod.Settings.set_site_live(true)
Berrypod.Site.seed_defaults()
:ok
end
describe "About page" do
test "renders about page", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/about")
assert html =~ "About us"
assert html =~ "Tell your customers who you are"
end
test "displays about content body", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/about")
assert html =~ "placeholder text"
end
end
describe "Delivery page" do
test "renders delivery page", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/delivery")
assert html =~ "Delivery &amp; returns"
assert html =~ "shipping and returns"
end
test "displays delivery content", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/delivery")
assert html =~ "Production time"
assert html =~ "Returns &amp; exchanges"
assert html =~ "Cancellations"
end
test "displays shipping fallback when no rates are configured", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/delivery")
assert html =~ "worldwide"
end
end
describe "Privacy page" do
test "renders privacy page", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/privacy")
assert html =~ "Privacy policy"
assert html =~ "personal information"
end
test "displays privacy content", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/privacy")
assert html =~ "What we collect"
assert html =~ "Cookies"
assert html =~ "Your rights"
end
end
describe "Terms page" do
test "renders terms page", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/terms")
assert html =~ "Terms of service"
assert html =~ "The legal bits"
end
test "displays terms content", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/terms")
assert html =~ "Products"
assert html =~ "Payment"
assert html =~ "Intellectual property"
end
end
describe "Footer links" do
test "footer contains policy page links", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/about")
assert html =~ ~s(href="/delivery")
assert html =~ ~s(href="/privacy")
assert html =~ ~s(href="/terms")
assert html =~ ~s(href="/contact")
end
end
end