mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
* commented out lesson and learning strip until lessons are established * reword the hero section * change layout and working on puzzle section - remove top div as it was redundant * amend flash message on replay * switch cancel session for return home * remove system theme toggle since this is the default, leaving only light and dark toggles * add keyboard and screen reader support for play (#72) First draft covering the accessibility work in #72:\n\n- labelled SAN/UCI move input, validated against the tablebase and applied\n by the board hook, plus an accessible promotion picker\n- live-region announcements for moves, checks, checkmates and solve/fail,\n and a hidden text summary of the position\n- accessible labels, focus ring, skip link, keyboard-friendly review table\n and non-colour grade cues\n- WCAG AA text contrast roles and a responsive play surface\n- regression tests for move entry, announcements and link-style CTAs
28 lines
898 B
Elixir
28 lines
898 B
Elixir
defmodule ChesstrainerWeb.Board.PositionTextTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias ChesstrainerWeb.Board.PositionText
|
|
|
|
test "names the side to move and every piece" do
|
|
assert PositionText.summary("8/8/3k4/8/8/3K1R2/8/8 w - - 0 1") ==
|
|
"White to move. White: king on d3, rook on f3. Black: king on d6."
|
|
end
|
|
|
|
test "describes black to move" do
|
|
assert PositionText.summary("8/8/3k4/8/8/3K1R2/8/8 b - - 0 1") =~
|
|
"Black to move."
|
|
end
|
|
|
|
test "includes pawns and both colours" do
|
|
summary = PositionText.summary("8/8/3k4/8/8/3K1R2/4P3/8 w - - 0 1")
|
|
|
|
assert summary =~ "White: king on d3, rook on f3, pawn on e2."
|
|
assert summary =~ "Black: king on d6."
|
|
end
|
|
|
|
test "falls back when the FEN cannot be read" do
|
|
assert PositionText.summary("not a fen") == "Chess position."
|
|
assert PositionText.summary(nil) == "Chess position."
|
|
end
|
|
end
|