Open any toolbox from a list in Sokko TCG's toolbox drawer
Every Sokko TCG section now offers the top bar's toolbox button. Instead of linking a toolbox, the drawer lists all toolboxes (linked to a game or not) as wide rows with a large cover, opens the one chosen, and remembers it on the device. Memos and alerts follow the toolbox shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8fe27a90f
commit
8253f74c90
17 changed files with 359 additions and 45 deletions
38
tests/toolbox-targets.test.mjs
Normal file
38
tests/toolbox-targets.test.mjs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Rôle : vérifie quelles pages ouvrent le tiroir de toolbox et quelle toolbox il affiche : la toolbox liée d'un jeu, ou celle
|
||||
// choisie dans Sokko TCG, sans liaison.
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { CARDS_TOOLBOX_TARGET_ID, getDrawerToolboxId, getRouteToolboxTargetId } from "../website/src/features/toolboxes/toolboxTargets.js";
|
||||
|
||||
test("a game page targets its game", () => {
|
||||
assert.equal(getRouteToolboxTargetId("/games/mhwilds"), "mhwilds");
|
||||
assert.equal(getRouteToolboxTargetId("/games/mhwilds/monsters"), "mhwilds");
|
||||
});
|
||||
|
||||
test("every Sokko TCG section shares the same target", () => {
|
||||
for (const route of ["/cards", "/cards/guild", "/cards/expeditions", "/cards/expeditions/abc", "/cards/admin/catalog"]) {
|
||||
assert.equal(getRouteToolboxTargetId(route), CARDS_TOOLBOX_TARGET_ID, route);
|
||||
}
|
||||
});
|
||||
|
||||
test("other pages have no target", () => {
|
||||
for (const route of ["/", "/games", "/toolboxes", "/toolbox/abc", "/library", "/cardsx", "/games/sokko-tcg"]) {
|
||||
assert.equal(getRouteToolboxTargetId(route), "", route);
|
||||
}
|
||||
});
|
||||
|
||||
test("a game drawer shows the toolbox linked to the game", () => {
|
||||
const links = { mhwilds: "tbx1" };
|
||||
assert.equal(getDrawerToolboxId("mhwilds", links, "tbx2", [{ id: "tbx1" }, { id: "tbx2" }]), "tbx1");
|
||||
assert.equal(getDrawerToolboxId("diablo4", links, "tbx2", [{ id: "tbx1" }, { id: "tbx2" }]), "");
|
||||
assert.equal(getDrawerToolboxId("", links, "tbx2", [{ id: "tbx1" }, { id: "tbx2" }]), "");
|
||||
});
|
||||
|
||||
test("the Sokko TCG drawer shows the chosen toolbox, linked to a game or not, until it is deleted", () => {
|
||||
const links = { mhwilds: "tbx1" };
|
||||
const toolboxes = [{ id: "tbx1" }, { id: "tbx2" }];
|
||||
assert.equal(getDrawerToolboxId(CARDS_TOOLBOX_TARGET_ID, links, "tbx1", toolboxes), "tbx1");
|
||||
assert.equal(getDrawerToolboxId(CARDS_TOOLBOX_TARGET_ID, links, "tbx2", toolboxes), "tbx2");
|
||||
assert.equal(getDrawerToolboxId(CARDS_TOOLBOX_TARGET_ID, links, "", toolboxes), "");
|
||||
assert.equal(getDrawerToolboxId(CARDS_TOOLBOX_TARGET_ID, links, "deleted", toolboxes), "");
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue