create endgame play section

This commit is contained in:
2026-08-11 21:52:33 +02:00
parent ca51546be0
commit 88bb016bac
13 changed files with 594 additions and 26 deletions
@@ -0,0 +1,28 @@
defmodule ChesstrainerWeb.EndgameLive.PlayerIndexTest do
use ChesstrainerWeb.ConnCase
import Phoenix.LiveViewTest
import Chesstrainer.EndgamesFixtures
test "lists endgames with a play link per row", %{conn: conn} do
endgame = endgame_fixture()
other = endgame_fixture()
{:ok, _view, html} = live(conn, ~p"/endgames")
assert html =~ "Endgames"
assert html =~ endgame.key
assert html =~ other.key
assert html =~ ~p"/endgames/#{endgame}/play"
assert html =~ ~p"/endgames/#{other}/play"
end
test "navigating to a play page renders the board", %{conn: conn} do
endgame = endgame_fixture()
{:ok, view, _html} = live(conn, ~p"/endgames/#{endgame}/play")
assert has_element?(view, "#endgame-board")
assert has_element?(view, ~s{a[href="/endgames"]})
end
end