fix: pass background_versions into stage_cell

ab36553 · gmorell · 2026-06-23 19:27

10 files +39 -0
Message
{commit_body(@commit)}

Files changed

modified lib/waxx_web/live/board_live/show.ex
+3 −0
@@ -774,6 +774,7 @@ defmodule WaxxWeb.BoardLive.Show do
774 774 board={@board}
775 775 card_templates={@card_templates}
776 776 hide_label_text={@hide_label_text}
777 + background_versions={@background_versions}
777 778 />
778 779
779 780 <%= for sb <- @board.subboards do %>
@@ -789,6 +790,7 @@ defmodule WaxxWeb.BoardLive.Show do
789 790 board={@board}
790 791 card_templates={@card_templates}
791 792 hide_label_text={@hide_label_text}
793 + background_versions={@background_versions}
792 794 />
793 795 <% end %>
794 796 </div>
@@ -1038,6 +1040,7 @@ defmodule WaxxWeb.BoardLive.Show do
1038 1040 attr :board, :map, required: true
1039 1041 attr :card_templates, :list, default: []
1040 1042 attr :hide_label_text, :boolean, default: false
1043 + attr :background_versions, :map, default: %{}
1041 1044
1042 1045 defp stage_cell(assigns) do
1043 1046 ~H"""
added test/waxx_web/live/board_live/show_test.exs
+36 −0
@@ -0,0 +1,36 @@
1 +defmodule WaxxWeb.BoardLive.ShowTest do
2 + use WaxxWeb.ConnCase, async: true
3 +
4 + import Phoenix.LiveViewTest
5 + import Waxx.AccountsFixtures
6 + import Waxx.KanbanFixtures
7 +
8 + alias Waxx.Kanban
9 +
10 + # 1x1 transparent PNG.
11 + @png_data_url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
12 +
13 + test "renders the board with its cards", %{conn: conn} do
14 + user = confirmed_user_fixture()
15 + board = board_fixture(user)
16 + card = card_fixture(board, user, %{"title" => "Buy milk"})
17 +
18 + {:ok, _lv, html} = live(log_in_user(conn, user), ~p"/boards/#{board.id}")
19 +
20 + assert html =~ "Buy milk"
21 + refute html =~ "/cards/#{card.id}/background"
22 + end
23 +
24 + test "a card with a background renders the tile background URL", %{conn: conn} do
25 + user = confirmed_user_fixture()
26 + board = board_fixture(user)
27 + card = card_fixture(board, user, %{"title" => "Has art"})
28 + {:ok, _} = Kanban.set_card_background(card, @png_data_url)
29 +
30 + {:ok, _lv, html} = live(log_in_user(conn, user), ~p"/boards/#{board.id}")
31 +
32 + # The tile references the lazy image endpoint, not inlined bytes.
33 + assert html =~ "/cards/#{card.id}/background?v="
34 + refute html =~ "data:image/png;base64"
35 + end
36 +end

Parents: 2a1eab5