mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
Full-width list/show pages and trim the admin table
List and show pages now use a wide container (max-w-7xl) while the form and play pages keep the narrow column. The admin table drops Fen, Message, Notes, Attempted and Solved — all already shown on the show page — so it fits without right-overflow. Closes #16
This commit is contained in:
@@ -13,7 +13,9 @@ defmodule ChesstrainerWeb.EndgameLive.FormTest do
|
||||
test "creates an endgame with staged themes", %{conn: conn} do
|
||||
theme = theme_fixture(%{name: "Lucena"})
|
||||
|
||||
{:ok, view, _html} = live(conn, ~p"/admin/endgames/new")
|
||||
{:ok, view, html} = live(conn, ~p"/admin/endgames/new")
|
||||
|
||||
assert html =~ "max-w-2xl"
|
||||
|
||||
view |> form("#theme-form", %{theme_search: "Luc"}) |> render_change()
|
||||
view |> element("button", "Lucena") |> render_click()
|
||||
|
||||
@@ -11,12 +11,28 @@ defmodule ChesstrainerWeb.EndgameLive.IndexTest do
|
||||
endgame_fixture()
|
||||
endgame_fixture()
|
||||
|
||||
{:ok, view, _html} = live(conn, ~p"/admin/endgames")
|
||||
{:ok, view, html} = live(conn, ~p"/admin/endgames")
|
||||
|
||||
assert html =~ "max-w-7xl"
|
||||
assert has_element?(view, "#key-group-K-v-K")
|
||||
assert has_element?(view, "#key-group-K-v-K .badge", "2")
|
||||
end
|
||||
|
||||
test "trims the table to the key columns", %{conn: conn} do
|
||||
endgame_fixture()
|
||||
|
||||
{:ok, view, _html} = live(conn, ~p"/admin/endgames")
|
||||
view |> element("#key-group-K-v-K button") |> render_click()
|
||||
|
||||
for label <- ~w(Key Color Result Themes Rating) do
|
||||
assert has_element?(view, "th", label)
|
||||
end
|
||||
|
||||
for label <- ~w(Fen Message Notes Attempted Solved) do
|
||||
refute has_element?(view, "th", label)
|
||||
end
|
||||
end
|
||||
|
||||
test "lazy-loads a group's endgames when expanded", %{conn: conn} do
|
||||
theme = theme_fixture(%{name: "Lucena"})
|
||||
endgame = endgame_fixture()
|
||||
@@ -25,13 +41,13 @@ defmodule ChesstrainerWeb.EndgameLive.IndexTest do
|
||||
{:ok, view, html} = live(conn, ~p"/admin/endgames")
|
||||
|
||||
# collapsed: the endgame row (and its themes) are not rendered yet
|
||||
refute html =~ endgame.fen
|
||||
refute html =~ ~p"/endgames/#{endgame}/play"
|
||||
refute html =~ "Lucena"
|
||||
|
||||
view |> element("#key-group-K-v-K button") |> render_click()
|
||||
|
||||
html = render(view)
|
||||
assert html =~ endgame.fen
|
||||
assert html =~ ~p"/endgames/#{endgame}/play"
|
||||
assert html =~ "Lucena"
|
||||
end
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ defmodule ChesstrainerWeb.EndgameLive.PlayTest do
|
||||
assert html =~ "KQ v K"
|
||||
assert html =~ "White to move"
|
||||
assert html =~ "1800"
|
||||
assert html =~ "max-w-2xl"
|
||||
end
|
||||
|
||||
test "raises when the endgame does not exist", %{conn: conn} do
|
||||
|
||||
@@ -16,6 +16,7 @@ defmodule ChesstrainerWeb.EndgameLive.PlayerIndexTest do
|
||||
{:ok, view, html} = live(conn, ~p"/endgames")
|
||||
|
||||
assert html =~ "Endgames"
|
||||
assert html =~ "max-w-7xl"
|
||||
assert has_element?(view, "#key-group-K-v-K")
|
||||
refute html =~ "Lucena"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user