Improve toolbox checklists, image browsing, and guide integration
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
00e73f0062
commit
386212041f
47 changed files with 744 additions and 112 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Rôle : vérifie les correspondances des guides et la validité des associations de session.
|
||||
// Rôle : vérifie les correspondances des guides et la validité des associations persistantes.
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { aniimoChecklistEntries, matchGuideChecklist, normalizeGuideLabel, toggleGuideChecklistRows, validGuideAssociations } from "../website/src/features/games/guideChecklist.js";
|
||||
|
|
@ -58,7 +58,7 @@ test("card toggles update every exact matching row to its target or zero", () =>
|
|||
assert.equal(data.sections[0].items[0].qtyCurrent, 1);
|
||||
});
|
||||
|
||||
test("session associations require the current linked toolbox and an existing checklist", () => {
|
||||
test("persistent associations require the current linked toolbox and an existing checklist", () => {
|
||||
const toolbox = { id: "tb", modules: [{ id: "capture", type: "checklist" }, { id: "notes", type: "notepad" }] };
|
||||
const association = { toolboxId: "tb", moduleId: "capture", hideCompleted: true };
|
||||
const state = { "aniimo/aniimos": association, "mhwilds/monsters": { ...association, moduleId: "notes" }, unknown: association };
|
||||
|
|
|
|||
|
|
@ -320,12 +320,14 @@ export function validateSiteContent(site) {
|
|||
"toolboxes.modules.checklist.sectionPlaceholder",
|
||||
"toolboxes.modules.checklist.quantityLabel",
|
||||
"toolboxes.modules.checklist.addButton",
|
||||
"toolboxes.modules.checklist.emptyItems",
|
||||
"toolboxes.modules.checklist.importPlaceholder",
|
||||
"toolboxes.modules.checklist.importOpenButton",
|
||||
"toolboxes.modules.checklist.importModalTitle",
|
||||
"toolboxes.modules.checklist.importButton",
|
||||
"toolboxes.modules.checklist.hideCompletedSectionsTitle",
|
||||
"toolboxes.modules.checklist.hideCompletedSectionsFullyTitle",
|
||||
"toolboxes.modules.checklist.hideCompletedItemsTitle",
|
||||
"toolboxes.modules.checklist.completedSectionsModeTitle",
|
||||
"toolboxes.modules.checklist.completedSectionsVisibleLabel",
|
||||
"toolboxes.modules.checklist.completedSectionsReducedLabel",
|
||||
|
|
@ -343,12 +345,20 @@ export function validateSiteContent(site) {
|
|||
"toolboxes.modules.checklist.editTitle",
|
||||
"toolboxes.modules.checklist.deleteTitle",
|
||||
"toolboxes.modules.images.addImages",
|
||||
"toolboxes.modules.images.emptyImages",
|
||||
"toolboxes.modules.images.pastePlaceholder",
|
||||
"toolboxes.modules.images.pasteAriaLabel",
|
||||
"toolboxes.modules.images.imageAlt",
|
||||
"toolboxes.modules.images.labelPlaceholder",
|
||||
"toolboxes.modules.images.labelAriaLabel",
|
||||
"toolboxes.modules.images.previewAriaLabel",
|
||||
"toolboxes.modules.images.galleryButton",
|
||||
"toolboxes.modules.images.galleryTitle",
|
||||
"toolboxes.modules.images.galleryImageAriaLabel",
|
||||
"toolboxes.modules.images.returnGalleryTitle",
|
||||
"toolboxes.modules.images.previousImageTitle",
|
||||
"toolboxes.modules.images.nextImageTitle",
|
||||
"toolboxes.modules.images.positionLabel",
|
||||
"toolboxes.modules.images.annotateAriaLabel",
|
||||
"toolboxes.modules.images.annotateTitle",
|
||||
"toolboxes.modules.images.deleteAriaLabel",
|
||||
|
|
@ -356,6 +366,7 @@ export function validateSiteContent(site) {
|
|||
"toolboxes.modules.links.titlePlaceholder",
|
||||
"toolboxes.modules.links.urlPlaceholder",
|
||||
"toolboxes.modules.links.addButton",
|
||||
"toolboxes.modules.links.emptyLinks",
|
||||
"toolboxes.modules.links.importPlaceholder",
|
||||
"toolboxes.modules.links.importOpenButton",
|
||||
"toolboxes.modules.links.importModalTitle",
|
||||
|
|
@ -365,6 +376,7 @@ export function validateSiteContent(site) {
|
|||
"toolboxes.modules.links.deleteTitle",
|
||||
"toolboxes.modules.counters.labelPlaceholder",
|
||||
"toolboxes.modules.counters.addButton",
|
||||
"toolboxes.modules.counters.emptyCounters",
|
||||
"toolboxes.modules.counters.decrementLabel",
|
||||
"toolboxes.modules.counters.incrementLabel",
|
||||
"toolboxes.modules.counters.resetTitle",
|
||||
|
|
|
|||
|
|
@ -170,6 +170,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
const textImportPlanning = await readFile("website/src/features/toolboxes/modules/textImport/planning.js", "utf8");
|
||||
const textImportTime = await readFile("website/src/features/toolboxes/modules/textImport/time.js", "utf8");
|
||||
const imageViewer = await readFile("website/src/components/ImageViewer.jsx", "utf8");
|
||||
const imageGallery = await readFile("website/src/components/ImageGallery.jsx", "utf8");
|
||||
const moduleEmptyMessage = await readFile("website/src/features/toolboxes/modules/ModuleEmptyMessage.jsx", "utf8");
|
||||
const randomizerModule = await readFile("website/src/features/toolboxes/modules/RandomizerModule.jsx", "utf8");
|
||||
const randomizerDice = await readFile("website/src/features/toolboxes/modules/randomizer/RandomizerDice.jsx", "utf8");
|
||||
const randomizerWheel = await readFile("website/src/features/toolboxes/modules/randomizer/RandomizerWheel.jsx", "utf8");
|
||||
|
|
@ -228,6 +230,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(addToolControls, /tool-add-quick-toggle/);
|
||||
assert.match(moduleMetadataRegistry, /scrollable: true/);
|
||||
assert.match(moduleShell, /module-content/);
|
||||
assert.match(moduleShell, /scrollIntoView/);
|
||||
assert.match(moduleShell, /data-module-id/);
|
||||
assert.match(moduleShell, /module-scroll-button/);
|
||||
assert.match(moduleShell, /module-collapse-button/);
|
||||
assert.match(moduleShell, /aria-expanded=\{!collapsed\}/);
|
||||
|
|
@ -395,6 +399,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(checklistParts, /checklist-qty-current/);
|
||||
assert.match(checklistParts, /checklist-delete-button nds-icon-button/);
|
||||
assert.match(checklistModule, /useGroupedReorder/);
|
||||
assert.match(checklistModule, /hideCompletedItems/);
|
||||
assert.match(checklistParts, /visibleItems/);
|
||||
assert.match(checklistBundle, /getItemProps/);
|
||||
assert.match(checklistParts, /getGroupProps/);
|
||||
assert.match(checklistModule, /getGroupBoundaryProps/);
|
||||
|
|
@ -411,6 +417,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(imagesModule, /createImageAnnotationModule/);
|
||||
assert.match(imagesModule, /TextExchangeActions/);
|
||||
assert.match(imagesModule, /image-annotate-button/);
|
||||
assert.match(imagesModule, /kind: "collection"/);
|
||||
assert.match(imagesModule, /galleryButton/);
|
||||
assert.match(imagesModule, /dataTransfer\.files/);
|
||||
assert.match(imageAnnotationModule, /export function ImageAnnotationModule/);
|
||||
assert.match(imageAnnotationModule, /annotation-marker/);
|
||||
|
|
@ -455,6 +463,11 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(imageViewer, /!hasMarkers &&/);
|
||||
assert.match(imageViewer, /<Icon name="zoom"/);
|
||||
assert.match(imageViewer, /annotation-marker-list themed-scrollbar/);
|
||||
assert.match(imageViewer, /ArrowLeft/);
|
||||
assert.match(imageViewer, /ArrowRight/);
|
||||
assert.match(imageViewer, /<ImageGallery/);
|
||||
assert.match(imageGallery, /image-viewer-gallery-item/);
|
||||
assert.match(moduleEmptyMessage, /toolbox-module-empty/);
|
||||
});
|
||||
|
||||
test("task planner helpers keep hierarchy, reorder and reset behavior stable", () => {
|
||||
|
|
|
|||
|
|
@ -1193,6 +1193,33 @@ test("checklist data drops empty titled sections", () => {
|
|||
assert.deepEqual(compact.sections.map((section) => section.id), ["filled"]);
|
||||
});
|
||||
|
||||
test("checklist completed-item visibility survives compact storage and toolbox export", () => {
|
||||
const data = {
|
||||
hideCompletedItems: true,
|
||||
hideCompletedSections: true,
|
||||
hideCompletedSectionsFully: false,
|
||||
sections: [{ id: "section", title: "Craft", items: [{ id: "item", label: "Ore", qtyTarget: 3, qtyCurrent: 3 }] }]
|
||||
};
|
||||
const normalized = normalizeChecklistData(data);
|
||||
assert.equal(normalized.hideCompletedItems, true);
|
||||
|
||||
const compact = compactModuleDataForStorage("checklist", data);
|
||||
assert.equal(compact.hideCompletedItems, true);
|
||||
assert.equal(compact.hideCompletedSections, true);
|
||||
assert.equal("hideCompletedSectionsFully" in compact, false);
|
||||
assert.deepEqual(compactModuleDataForStorage("checklist", { hideCompletedItems: true, sections: [] }), { hideCompletedItems: true });
|
||||
|
||||
const payload = createToolboxExportPayload({
|
||||
id: "source",
|
||||
name: "Checklist export",
|
||||
modules: [{ id: "checklist", type: "checklist", title: "Checklist" }]
|
||||
}, { [moduleStorageKey("source", "checklist")]: data });
|
||||
const exported = Object.values(payload.modules)[0];
|
||||
assert.equal(exported.hideCompletedItems, true);
|
||||
assert.equal(exported.hideCompletedSections, true);
|
||||
assert.equal(exported.sections[0].items[0].qtyCurrent, 3);
|
||||
});
|
||||
|
||||
test("checklist helpers merge categories and move items deterministically", () => {
|
||||
const context = { uid: (prefix) => `${prefix}-new` };
|
||||
const sections = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue