feat: add gameplay assists and variant generator
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { render } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { normalizePuzzle } from "../../src/domain";
|
||||
import { SudokuBoard } from "../../src/components/SudokuBoard";
|
||||
|
||||
describe("Sudoku board constraint visuals", () => {
|
||||
it("distinguishes XV sums from directional inequalities", () => {
|
||||
const puzzle = normalizePuzzle({
|
||||
version: 1,
|
||||
size: 4,
|
||||
givens: new Array<number>(16).fill(0),
|
||||
constraints: [
|
||||
{ type: "xv", a: 0, b: 1, total: 5 },
|
||||
{ type: "xv", a: 4, b: 5, total: 10 },
|
||||
{ type: "inequality", lesser: 8, greater: 9 },
|
||||
],
|
||||
});
|
||||
|
||||
const { container } = render(
|
||||
<SudokuBoard
|
||||
puzzle={puzzle}
|
||||
values={puzzle.givens}
|
||||
selected={new Set([0])}
|
||||
activeCell={0}
|
||||
onCellPointerDown={vi.fn()}
|
||||
onCellPointerEnter={vi.fn()}
|
||||
onKeyDown={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(container.querySelector(".constraint-xv--5 text")).toHaveTextContent(
|
||||
"5",
|
||||
);
|
||||
expect(
|
||||
container.querySelector(".constraint-xv--10 text"),
|
||||
).toHaveTextContent("10");
|
||||
expect(
|
||||
container.querySelector(".constraint-inequality path"),
|
||||
).toHaveAttribute("d", "M0.12 -0.17L-0.12 0L0.12 0.17");
|
||||
expect(
|
||||
container.querySelector(".constraint-inequality-tip"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user