Improve toolbox module loading and goal tree previews
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
This commit is contained in:
parent
abfa23fb3e
commit
50029b45a2
9 changed files with 259 additions and 177 deletions
|
|
@ -5,6 +5,7 @@ import { evaluateTableCell } from "../website/src/features/toolboxes/modules/tab
|
|||
import { exportModuleText, importModuleText, parseColonImportLines } from "../website/src/features/toolboxes/modules/textImport.js";
|
||||
import { buildInsertedMixTagValue, normalizeMixTagSpacing, normalizeMixTagText, removeMixTagAtOffset, tokenizeMixTagValue } from "../website/src/utils/mixTagsInputUtils.js";
|
||||
import { calculateGoalTreeFormula, evaluateGoalTreeNodes } from "../website/src/features/toolboxes/modules/goalTreeUtils.js";
|
||||
import { getMonthOccurrenceSegments, getWeekGridLayout, getWeekMinutePosition, layoutConcurrentOccurrences } from "../website/src/features/toolboxes/modules/calendarLayout.js";
|
||||
import { getTimePatternRecurrenceMs, getTimePatternTargetMs } from "../website/src/features/toolboxes/modules/timerUtils.js";
|
||||
import { compactModuleDataForStorage, createToolboxExportPayload, normalizeCalculatorData, normalizeChecklistData, normalizeCombosData, normalizeCountersData, normalizeEquipmentPlannerData, normalizeGoalTreeData, normalizeImageAnnotationData, normalizeLinksData, normalizeModuleOrder, normalizeNotepadData, normalizeTableData, normalizeTaskPlannerData, normalizeTimerData, normalizeToolbox, normalizeUrl, summarizeEquipmentPlannerData } from "../website/src/features/toolboxes/storage/toolboxStorage.js";
|
||||
import { applyGroupedReorderOperation, completeGroupOrder, getBoundaryItemId, getGroupedEntries, moveGroupOrder, moveGroupOrderToEnd, moveGroupOrderToStart, moveItem, moveItemGroup } from "../website/src/hooks/useGroupedReorder.js";
|
||||
|
|
@ -150,6 +151,41 @@ test("text exchange imports table TSV and calculator hierarchy", () => {
|
|||
assert.equal(calculatorImport.data.entries[1].formula, "base*5");
|
||||
});
|
||||
|
||||
test("calendar layout keeps week compaction and overlapping lanes deterministic", () => {
|
||||
const base = new Date(2026, 0, 5, 8, 0, 0, 0).getTime();
|
||||
const occurrences = [
|
||||
{ id: "a", startMs: base, endMs: base + 60 * 60000, event: { startMinutes: 8 * 60, endMinutes: 9 * 60 } },
|
||||
{ id: "b", startMs: base + 30 * 60000, endMs: base + 90 * 60000, event: { startMinutes: 8 * 60 + 30, endMinutes: 9 * 60 + 30 } }
|
||||
];
|
||||
const layout = getWeekGridLayout(occurrences, true);
|
||||
assert.ok(layout.rows.some((row) => row.type === "hidden"));
|
||||
assert.equal(getWeekMinutePosition(layout, 8 * 60), layout.hourTopPx[8]);
|
||||
assert.equal(getWeekMinutePosition(layout, 24 * 60), layout.totalHeightPx);
|
||||
assert.deepEqual(layoutConcurrentOccurrences(occurrences).map((occurrence) => [occurrence.id, occurrence.lane, occurrence.laneCount]), [
|
||||
["a", 0, 2],
|
||||
["b", 1, 2]
|
||||
]);
|
||||
});
|
||||
|
||||
test("calendar month layout splits bars on week boundaries and shares lanes", () => {
|
||||
const days = Array.from({ length: 14 }, (_, index) => ({
|
||||
date: new Date(2026, 0, 5 + index),
|
||||
inMonth: true
|
||||
}));
|
||||
const firstStart = days[4].date.getTime();
|
||||
const secondStart = days[5].date.getTime();
|
||||
const segments = getMonthOccurrenceSegments(days, [
|
||||
{ id: "a", startMs: firstStart, endMs: days[9].date.getTime(), event: {} },
|
||||
{ id: "b", startMs: secondStart, endMs: days[7].date.getTime(), event: {} }
|
||||
]);
|
||||
assert.deepEqual(segments.map((segment) => [segment.occurrence.id, segment.lane, segment.startIndex, segment.endIndex]), [
|
||||
["a", 0, 4, 6],
|
||||
["a", 0, 7, 8],
|
||||
["b", 1, 5, 6]
|
||||
]);
|
||||
assert.equal(segments[0].laneCount, 2);
|
||||
});
|
||||
|
||||
test("goal tree text exchange imports formulas and hierarchy", () => {
|
||||
const context = createTextImportContext();
|
||||
const imported = importModuleText("goalTree", "- Breuvage de rage x10\n - Élixir de destruction = base * 3\n - Poudre de flamme x5\n - Sève de cèdre x7\n - Catalyseur magique x10", context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue