Extract timer module components
All checks were successful
Deploy Sokko G / deploy (push) Successful in 14s

This commit is contained in:
Shinuwa 2026-08-14 10:12:40 +02:00
parent d4fe3c796a
commit 3007aa1389
4 changed files with 467 additions and 426 deletions

View file

@ -6,6 +6,7 @@ import { SOCKET_SHAPES, formatValue, getSocketItemName, setItemCategory } from "
import { applyDueResets, getTaskParentMap, getTaskTreeIds, moveTask } from "../website/src/features/toolboxes/modules/taskPlannerUtils.js";
import { createInput, getInputLabel, normalizeCustomKey, parseHoldSeconds } from "../website/src/features/toolboxes/modules/combosUtils.js";
import { getBoundsFromStartAndSize, getSelectionBounds, moveSelectionCells, parseTsvBlock, pasteCellBlock } from "../website/src/features/toolboxes/modules/tableUtils.js";
import { canToggleAutoRefresh, getCountdownValidationError, isAlertGuarded } from "../website/src/features/toolboxes/modules/timerOptions.js";
test("toolbox storage, cards and pages are wired", async () => {
const source = await readFile("website/src/main.jsx", "utf8");
@ -124,6 +125,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
const tableUtils = await readFile("website/src/features/toolboxes/modules/tableUtils.js", "utf8");
const tableFormulaEngine = await readFile("website/src/features/toolboxes/modules/tableFormulaEngine.js", "utf8");
const timerModule = await readFile("website/src/features/toolboxes/modules/TimerModule.jsx", "utf8");
const timerParts = await readFile("website/src/features/toolboxes/modules/TimerParts.jsx", "utf8");
const timerOptions = await readFile("website/src/features/toolboxes/modules/timerOptions.js", "utf8");
const taskPlannerModule = await readFile("website/src/features/toolboxes/modules/TaskPlannerModule.jsx", "utf8");
const taskPlannerItems = await readFile("website/src/features/toolboxes/modules/TaskPlannerItems.jsx", "utf8");
const taskPlannerUtils = await readFile("website/src/features/toolboxes/modules/taskPlannerUtils.js", "utf8");
@ -267,7 +270,7 @@ test("toolbox module registry and modules expose expected behavior", async () =>
assert.match(timerModule, /Tabs/);
assert.match(timerModule, /stopwatch/);
assert.match(timerModule, /countdown/);
assert.match(timerModule, /useInlineEdit/);
assert.match(timerParts, /useInlineEdit/);
assert.match(timerModule, /useDraftForm/);
assert.match(timerModule, /normalizeTimerData/);
assert.match(timerModule, /TextExchangeActions/);
@ -371,7 +374,11 @@ test("toolbox module registry and modules expose expected behavior", async () =>
assert.match(timerModule, /useGroupedReorder/);
assert.match(timerModule, /reorderEnabled={!data\.sortResults}/);
assert.match(timerModule, /parentId=\{moduleId\}/);
assert.match(timerModule, /timer-drag-handle/);
assert.match(timerParts, /timer-drag-handle/);
assert.match(timerParts, /export function StopwatchControls/);
assert.match(timerParts, /export function CountdownControls/);
assert.match(timerParts, /export function CountdownList/);
assert.match(timerOptions, /export const ALERT_MIN_DELAY_MS/);
assert.match(textImport, /export function parseColonImportLines/);
assert.match(textImport, /export function exportModuleText/);
assert.match(textImport, /export function importModuleText/);
@ -451,3 +458,12 @@ test("table helpers keep selection, movement and TSV behavior stable", () => {
const pasted = pasteCellBlock({}, parseTsvBlock("A\t\nC\tD"), 0, 0, 2, 2);
assert.deepEqual(pasted.cells, { A1: "A", A2: "C", B2: "D" });
});
test("timer options keep alert guards and countdown validation stable", () => {
assert.equal(isAlertGuarded({ type: "interval", intervalMs: 60_000 }), true);
assert.equal(isAlertGuarded({ type: "interval", intervalMs: 600_000 }), false);
assert.equal(canToggleAutoRefresh({ type: "daily_time" }), true);
assert.equal(canToggleAutoRefresh({ type: "interval", intervalMs: 60_000 }), false);
assert.equal(getCountdownValidationError("duration", { duration: { hours: "", minutes: "", seconds: "" } }, {}), "Valeur requise.");
assert.equal(getCountdownValidationError("daily_time", { time: { hours: "12", minutes: "30", seconds: "" } }, {}), "");
});