Extract calendar draft helpers
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
d9bbf40fad
commit
f2c88ee891
4 changed files with 110 additions and 65 deletions
|
|
@ -6,6 +6,7 @@ import { exportModuleText, importModuleText, parseColonImportLines } from "../we
|
|||
import { buildInsertedMixTagValue, normalizeMixTagSpacing, normalizeMixTagText, removeMixTagAtOffset, tokenizeMixTagValue } from "../website/src/utils/mixTagsInputUtils.js";
|
||||
import { getEffectiveGoalTreeProgressMode, getVisibleGoalTreeEdges } from "../website/src/features/toolboxes/modules/goalTreeDisplay.js";
|
||||
import { calculateGoalTreeFormula, evaluateGoalTreeNodes } from "../website/src/features/toolboxes/modules/goalTreeUtils.js";
|
||||
import { createDefaultDraft, getDateSpanDays, getDraftSelection, normalizeDraftAlertOffsets, normalizeDraftMonthlyRepeatBy } from "../website/src/features/toolboxes/modules/calendarDraft.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";
|
||||
|
|
@ -168,6 +169,26 @@ test("calendar layout keeps week compaction and overlapping lanes deterministic"
|
|||
]);
|
||||
});
|
||||
|
||||
test("calendar draft helpers normalize selections and options", () => {
|
||||
const draft = createDefaultDraft(new Date(2026, 7, 14, 8, 17));
|
||||
assert.equal(draft.dayIndex, 4);
|
||||
assert.equal(draft.startDate, "2026-08-14");
|
||||
assert.equal(draft.startTime, "08:30");
|
||||
assert.equal(draft.endTime, "09:00");
|
||||
|
||||
assert.deepEqual(getDraftSelection({ ...draft, startTime: "08:30", endTime: "10:00" }), {
|
||||
dayIndex: 4,
|
||||
startSlot: 17,
|
||||
endSlot: 19
|
||||
});
|
||||
assert.equal(getDraftSelection({ ...draft, dayIndex: 8 }), null);
|
||||
assert.deepEqual(normalizeDraftAlertOffsets([10, 5, 10, "60", 999]), [10, 5]);
|
||||
assert.equal(normalizeDraftMonthlyRepeatBy("weekday"), "weekday");
|
||||
assert.equal(normalizeDraftMonthlyRepeatBy("invalid"), "monthDay");
|
||||
assert.equal(getDateSpanDays("2026-08-14", "2026-08-17"), 3);
|
||||
assert.equal(getDateSpanDays("2026-08-17", "2026-08-14"), 0);
|
||||
});
|
||||
|
||||
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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue