feat: expand sudoku analysis and interoperability

This commit is contained in:
2026-08-30 23:21:56 +02:00
parent 4a9869baa0
commit 8ca9300ab3
73 changed files with 12482 additions and 384 deletions
+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, it } from "vitest";
import { navigateGridCell } from "../../src/state/gridNavigation";
describe("accessible grid navigation", () => {
it("moves with arrows without wrapping at edges", () => {
expect(navigateGridCell(4, 3, "ArrowRight")).toBe(5);
expect(navigateGridCell(5, 3, "ArrowRight")).toBe(5);
expect(navigateGridCell(3, 3, "ArrowLeft")).toBe(3);
expect(navigateGridCell(1, 3, "ArrowUp")).toBe(1);
expect(navigateGridCell(7, 3, "ArrowDown")).toBe(7);
});
it("supports row, grid and column-edge shortcuts", () => {
expect(navigateGridCell(4, 3, "Home")).toBe(3);
expect(navigateGridCell(4, 3, "End")).toBe(5);
expect(navigateGridCell(4, 3, "Home", true)).toBe(0);
expect(navigateGridCell(4, 3, "End", true)).toBe(8);
expect(navigateGridCell(4, 3, "PageUp")).toBe(1);
expect(navigateGridCell(4, 3, "PageDown")).toBe(7);
});
it("ignores non-navigation keys and rejects unsafe inputs", () => {
expect(navigateGridCell(0, 9, "Enter")).toBeNull();
expect(() => navigateGridCell(-1, 9, "Home")).toThrow(/outside/i);
expect(() => navigateGridCell(0, 0, "Home")).toThrow(/size/i);
});
});