453 lines
27 KiB
JavaScript
453 lines
27 KiB
JavaScript
// Rôle : vérifie les invariants statiques des toolboxes et de leurs outils.
|
|
import { readFile } from "node:fs/promises";
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { SOCKET_SHAPES, formatValue, getSocketItemName, setItemCategory } from "../website/src/features/toolboxes/modules/equipmentPlannerOptions.js";
|
|
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";
|
|
|
|
test("toolbox storage, cards and pages are wired", async () => {
|
|
const source = await readFile("website/src/main.jsx", "utf8");
|
|
const toolboxCard = await readFile("website/src/features/toolboxes/ToolboxCard.jsx", "utf8");
|
|
const toolboxPages = await readFile("website/src/features/toolboxes/ToolboxPages.jsx", "utf8");
|
|
const toolboxActions = await readFile("website/src/features/toolboxes/useToolboxActions.js", "utf8");
|
|
const toolboxStorage = await readFile("website/src/features/toolboxes/storage/toolboxStorage.js", "utf8");
|
|
const storageCompactorRegistry = await readFile("website/src/features/toolboxes/storage/modules/index.js", "utf8");
|
|
const checklistStorage = await readFile("website/src/features/toolboxes/storage/modules/checklist.js", "utf8");
|
|
const timerStorage = await readFile("website/src/features/toolboxes/storage/modules/timer.js", "utf8");
|
|
const equipmentStorage = await readFile("website/src/features/toolboxes/storage/modules/equipmentPlanner.js", "utf8");
|
|
const indexedToolboxesHook = await readFile("website/src/features/toolboxes/storage/useIndexedToolboxes.js", "utf8");
|
|
const storageQuota = await readFile("website/src/components/StorageQuota.jsx", "utf8");
|
|
const importButton = await readFile("website/src/components/ImportButton.jsx", "utf8");
|
|
const reorderHook = await readFile("website/src/hooks/usePointerReorder.js", "utf8");
|
|
const groupedReorderHook = await readFile("website/src/hooks/useGroupedReorder.js", "utf8");
|
|
const inlineEditHook = await readFile("website/src/hooks/useInlineEdit.js", "utf8");
|
|
const draftFormHook = await readFile("website/src/hooks/useDraftForm.js", "utf8");
|
|
|
|
assert.match(`${indexedToolboxesHook}\n${toolboxPages}`, /indexedDbStorage\.js/);
|
|
assert.match(source, /features\/toolboxes\/storage\/useIndexedToolboxes\.js/);
|
|
assert.match(source, /features\/toolboxes\/useToolboxActions\.js/);
|
|
assert.match(indexedToolboxesHook, /export function useIndexedToolboxes/);
|
|
assert.match(indexedToolboxesHook, /getStorageEstimate/);
|
|
assert.match(toolboxActions, /export function useToolboxActions/);
|
|
assert.match(toolboxActions, /importAllToolboxesPayload/);
|
|
assert.match(toolboxActions, /async function addImageFiles/);
|
|
assert.match(`${source}\n${toolboxActions}`, /features\/toolboxes\/storage\/toolboxStorage\.js/);
|
|
assert.match(toolboxStorage, /TOOLBOX_ICON_FILES/);
|
|
assert.match(toolboxStorage, /export function normalizeToolboxIcon/);
|
|
assert.match(toolboxStorage, /export function createGlobalExportPayload/);
|
|
assert.match(checklistStorage, /qtyTarget/);
|
|
assert.match(checklistStorage, /qtyCurrent/);
|
|
assert.match(checklistStorage, /hideCompletedSections/);
|
|
assert.match(checklistStorage, /hideCompletedSectionsFully/);
|
|
assert.match(checklistStorage, /hideWhenComplete/);
|
|
assert.match(equipmentStorage, /collapsed/);
|
|
assert.match(toolboxStorage, /module\.scrollable/);
|
|
assert.match(toolboxStorage, /normalizeLinksData/);
|
|
assert.match(toolboxStorage, /normalizeCountersData/);
|
|
assert.match(toolboxStorage, /normalizeCombosData/);
|
|
assert.match(toolboxStorage, /normalizeCalculatorData/);
|
|
assert.match(toolboxStorage, /normalizeTableData/);
|
|
assert.match(toolboxStorage, /normalizeTimerData/);
|
|
assert.match(toolboxStorage, /normalizeTaskPlannerData/);
|
|
assert.match(toolboxStorage, /normalizeEquipmentPlannerData/);
|
|
assert.match(toolboxStorage, /summarizeEquipmentPlannerData/);
|
|
assert.match(toolboxStorage, /normalizeImageAnnotationData/);
|
|
assert.match(toolboxStorage, /export function compactModuleDataForStorage\(type, value\)/);
|
|
assert.match(storageCompactorRegistry, /export const MODULE_DATA_COMPACTORS/);
|
|
assert.match(storageCompactorRegistry, /timer: compactTimerDataForStorage/);
|
|
assert.match(timerStorage, /scrollResults/);
|
|
assert.match(toolboxCard, /DEFAULT_TOOLBOX_ICON/);
|
|
assert.match(toolboxCard, /export function ToolboxCard/);
|
|
assert.match(toolboxCard, /export function ToolboxIconPicker/);
|
|
assert.match(toolboxCard, /export function ToolboxGameIcon/);
|
|
assert.match(toolboxCard, /toolbox-card-drag-handle/);
|
|
assert.match(toolboxCard, /reorder\.getItemProps/);
|
|
assert.match(toolboxCard, /toolbox-card-cover-link/);
|
|
assert.match(toolboxCard, /toolbox-icon-cover/);
|
|
assert.match(toolboxPages, /\.\/ToolboxCard\.jsx/);
|
|
assert.match(toolboxPages, /updateToolboxOrder/);
|
|
assert.match(toolboxPages, /useGroupedReorder/);
|
|
assert.match(toolboxPages, /useInlineEdit/);
|
|
assert.match(toolboxPages, /getContentEditableProps/);
|
|
assert.match(toolboxPages, /orientation: "horizontal"/);
|
|
assert.match(toolboxPages, /components\/StorageQuota\.jsx/);
|
|
assert.match(toolboxPages, /components\/ImportButton\.jsx/);
|
|
assert.match(toolboxPages, /import-icon-button/);
|
|
assert.match(toolboxPages, /getToolboxGame\(toolbox\)/);
|
|
assert.match(toolboxPages, /Vers la page de jeu/);
|
|
assert.match(toolboxPages, /Vers la toolbox complète/);
|
|
assert.match(toolboxPages, /#\/games\/\$\{toolboxGame\.id\}/);
|
|
assert.match(toolboxPages, /#\/toolbox\/\$\{toolbox\.id\}/);
|
|
assert.match(toolboxPages, /setDrawerGameId\(""\)/);
|
|
assert.match(toolboxPages, /moduleColumns/);
|
|
assert.match(toolboxPages, /normalizeCombosData/);
|
|
assert.match(toolboxPages, /function ToolboxView/);
|
|
assert.doesNotMatch(toolboxPages, /usePointerReorder/);
|
|
assert.match(storageQuota, /export function StorageQuota/);
|
|
assert.match(storageQuota, /role="progressbar"/);
|
|
assert.match(importButton, /export function ImportButton/);
|
|
assert.match(importButton, /accept="application\/json"/);
|
|
assert.match(reorderHook, /export function usePointerReorder/);
|
|
assert.match(reorderHook, /setPointerCapture/);
|
|
assert.match(reorderHook, /elementsFromPoint/);
|
|
assert.match(reorderHook, /elementFromPoint/);
|
|
assert.match(groupedReorderHook, /export function useGroupedReorder/);
|
|
assert.match(groupedReorderHook, /usePointerReorder/);
|
|
assert.match(groupedReorderHook, /export function getGroupedEntries/);
|
|
assert.match(groupedReorderHook, /export function applyGroupedReorderOperation/);
|
|
assert.match(groupedReorderHook, /data-reorder-orientation/);
|
|
assert.match(groupedReorderHook, /operation\.sourceParentId === operation\.targetParentId/);
|
|
assert.match(inlineEditHook, /export function useInlineEdit/);
|
|
assert.match(inlineEditHook, /skipCommitRef/);
|
|
assert.match(inlineEditHook, /blurOnEscape/);
|
|
assert.match(inlineEditHook, /commitOnEnter/);
|
|
assert.match(inlineEditHook, /getContentEditableProps/);
|
|
assert.match(draftFormHook, /export function useDraftForm/);
|
|
assert.match(draftFormHook, /getFieldProps/);
|
|
assert.match(draftFormHook, /handleSubmit/);
|
|
assert.match(draftFormHook, /preventDefault/);
|
|
});
|
|
|
|
test("toolbox module registry and modules expose expected behavior", async () => {
|
|
const source = await readFile("website/src/main.jsx", "utf8");
|
|
const moduleRegistry = await readFile("website/src/features/toolboxes/modules/index.jsx", "utf8");
|
|
const moduleMetadataRegistry = await readFile("website/src/features/toolboxes/toolboxModuleRegistry.js", "utf8");
|
|
const notepadModule = await readFile("website/src/features/toolboxes/modules/NotepadModule.jsx", "utf8");
|
|
const combosModule = await readFile("website/src/features/toolboxes/modules/CombosModule.jsx", "utf8");
|
|
const combosParts = await readFile("website/src/features/toolboxes/modules/CombosParts.jsx", "utf8");
|
|
const combosUtils = await readFile("website/src/features/toolboxes/modules/combosUtils.js", "utf8");
|
|
const calculatorModule = await readFile("website/src/features/toolboxes/modules/CalculatorModule.jsx", "utf8");
|
|
const tableModule = await readFile("website/src/features/toolboxes/modules/TableModule.jsx", "utf8");
|
|
const tableGridParts = await readFile("website/src/features/toolboxes/modules/TableGridParts.jsx", "utf8");
|
|
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 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");
|
|
const equipmentPlannerModule = await readFile("website/src/features/toolboxes/modules/EquipmentPlannerModule.jsx", "utf8");
|
|
const equipmentPlannerEditors = await readFile("website/src/features/toolboxes/modules/EquipmentPlannerEditors.jsx", "utf8");
|
|
const equipmentPlannerItem = await readFile("website/src/features/toolboxes/modules/EquipmentPlannerItem.jsx", "utf8");
|
|
const equipmentPlannerPickers = await readFile("website/src/features/toolboxes/modules/EquipmentPlannerPickers.jsx", "utf8");
|
|
const equipmentPlannerSummary = await readFile("website/src/features/toolboxes/modules/EquipmentPlannerSummary.jsx", "utf8");
|
|
const equipmentPlannerOptions = await readFile("website/src/features/toolboxes/modules/equipmentPlannerOptions.js", "utf8");
|
|
const checklistModule = await readFile("website/src/features/toolboxes/modules/ChecklistModule.jsx", "utf8");
|
|
const imagesModule = await readFile("website/src/features/toolboxes/modules/ImagesModule.jsx", "utf8");
|
|
const imageAnnotationModule = await readFile("website/src/features/toolboxes/modules/ImageAnnotationModule.jsx", "utf8");
|
|
const linksModule = await readFile("website/src/features/toolboxes/modules/LinksModule.jsx", "utf8");
|
|
const textImportModal = await readFile("website/src/features/toolboxes/modules/TextImportModal.jsx", "utf8");
|
|
const textExchangeActions = await readFile("website/src/features/toolboxes/modules/TextExchangeActions.jsx", "utf8");
|
|
const textExchangeHook = await readFile("website/src/features/toolboxes/modules/useTextExchange.js", "utf8");
|
|
const countersModule = await readFile("website/src/features/toolboxes/modules/CountersModule.jsx", "utf8");
|
|
const textImport = await readFile("website/src/features/toolboxes/modules/textImport.js", "utf8");
|
|
const imageViewer = await readFile("website/src/components/ImageViewer.jsx", "utf8");
|
|
|
|
assert.match(moduleMetadataRegistry, /export const TOOLBOX_MODULES/);
|
|
assert.match(moduleMetadataRegistry, /export const TOOLBOX_MODULE_DEFINITIONS/);
|
|
assert.match(moduleMetadataRegistry, /export function getDefaultModuleTitle/);
|
|
assert.match(moduleRegistry, /export function AddToolControls/);
|
|
assert.match(moduleRegistry, /export function ToolboxModules/);
|
|
assert.match(moduleRegistry, /MODULE_COMPONENTS/);
|
|
assert.match(moduleRegistry, /notepad:/);
|
|
assert.match(moduleRegistry, /checklist:/);
|
|
assert.match(moduleRegistry, /images:/);
|
|
assert.match(moduleRegistry, /links:/);
|
|
assert.match(moduleRegistry, /counters:/);
|
|
assert.match(moduleRegistry, /combos:/);
|
|
assert.match(moduleRegistry, /CombosModule/);
|
|
assert.match(moduleRegistry, /calculator:/);
|
|
assert.match(moduleRegistry, /table:/);
|
|
assert.match(moduleRegistry, /table: \{ \.\.\.TOOLBOX_MODULE_DEFINITIONS\.table, Component: TableModule \}/);
|
|
assert.match(moduleRegistry, /timer:/);
|
|
assert.match(moduleRegistry, /taskPlanner:/);
|
|
assert.match(moduleRegistry, /equipmentPlanner:/);
|
|
assert.match(moduleMetadataRegistry, /Planificateur d'équipements/);
|
|
assert.match(moduleRegistry, /imageAnnotation:/);
|
|
assert.match(moduleMetadataRegistry, /Annotation d'images/);
|
|
assert.match(moduleRegistry, /notepad: \{ \.\.\.TOOLBOX_MODULE_DEFINITIONS\.notepad, Component: NotepadModule \}/);
|
|
assert.match(moduleRegistry, /module-edit-button/);
|
|
assert.match(moduleRegistry, /itemReorder\.startDrag/);
|
|
assert.match(moduleRegistry, /onPointerDown/);
|
|
assert.match(moduleRegistry, /useGroupedReorder/);
|
|
assert.match(moduleRegistry, /useInlineEdit/);
|
|
assert.match(moduleRegistry, /getContentEditableProps/);
|
|
assert.match(moduleRegistry, /tool-add-card/);
|
|
assert.match(moduleRegistry, /tool-quick-add-button/);
|
|
assert.match(moduleRegistry, /tool-add-quick-toggle/);
|
|
assert.match(moduleMetadataRegistry, /scrollable: true/);
|
|
assert.match(moduleRegistry, /module-content/);
|
|
assert.match(moduleRegistry, /module-scroll-button/);
|
|
assert.match(moduleRegistry, /Icon name="dropdown"/);
|
|
assert.match(moduleRegistry, /CompactDropdown/);
|
|
assert.doesNotMatch(source, /<select value="" onChange=\{\(event\) => addModule/);
|
|
assert.match(notepadModule, /export function NotepadModule/);
|
|
assert.match(notepadModule, /TextExchangeActions/);
|
|
assert.match(notepadModule, /type="notepad"/);
|
|
assert.match(combosModule, /export function CombosModule/);
|
|
assert.match(combosUtils, /keyboardMouse/);
|
|
assert.match(combosUtils, /Nintendo 64/);
|
|
assert.match(combosParts, /export function ComboInputToken/);
|
|
assert.match(combosParts, /export function ComboSequence/);
|
|
assert.match(combosModule, /keyboardLayout/);
|
|
assert.match(combosModule, /simultaneousMode/);
|
|
assert.match(combosUtils, /SPECIAL_INPUT_GROUP/);
|
|
assert.match(combosUtils, /grab/);
|
|
assert.match(combosUtils, /protect/);
|
|
assert.match(combosUtils, /shoot/);
|
|
assert.match(combosModule, /holdMs/);
|
|
assert.match(combosModule, /toggleSelectedInputHold/);
|
|
assert.match(combosModule, /combo-hold-field/);
|
|
assert.match(combosParts, /useInlineEdit/);
|
|
assert.match(combosModule, /useGroupedReorder/);
|
|
assert.match(combosModule, /reorderFeatures/);
|
|
assert.match(combosModule, /namespace: `combos-\$\{moduleId\}`/);
|
|
assert.match(combosModule, /getGroupBoundaryProps/);
|
|
assert.match(combosModule, /combos-category-boundary-drop-zone/);
|
|
assert.match(combosUtils, /function setComboItemCategory/);
|
|
assert.match(combosModule, /setItemGroup: setComboItemCategory/);
|
|
assert.doesNotMatch(combosModule, /canMoveItem:/);
|
|
assert.doesNotMatch(combosModule, /canMoveGroup:/);
|
|
assert.match(calculatorModule, /export function CalculatorModule/);
|
|
assert.match(calculatorModule, /calculateExpression/);
|
|
assert.match(calculatorModule, /activeParentId/);
|
|
assert.match(calculatorModule, /parentId/);
|
|
assert.match(calculatorModule, /useInlineEdit/);
|
|
assert.match(calculatorModule, /useGroupedReorder/);
|
|
assert.match(calculatorModule, /calculator-drag-handle/);
|
|
assert.match(calculatorModule, /scrollResults/);
|
|
assert.match(calculatorModule, /tool-split-scroll-toggle/);
|
|
assert.match(calculatorModule, /EditableCalculatorLabel/);
|
|
assert.match(calculatorModule, /tool-split-entry-label/);
|
|
assert.match(calculatorModule, /copyChecklistImport/);
|
|
assert.match(calculatorModule, /resetCalculator/);
|
|
assert.match(calculatorModule, /returnToRoot/);
|
|
assert.match(calculatorModule, /setExpression\(activeParent \? formatResult\(activeParent\.value\) : ""\)/);
|
|
assert.match(calculatorModule, /Quantité non modifiable/);
|
|
assert.match(calculatorModule, /entry\.label \|\| formatResult\(entry\.value\)/);
|
|
assert.match(calculatorModule, /ResizeObserver/);
|
|
assert.match(calculatorModule, /--calculator-scroll-height/);
|
|
assert.match(calculatorModule, /CalculatorEntries/);
|
|
assert.match(tableModule, /export function TableModule/);
|
|
assert.match(tableModule, /Icon name="add-row"/);
|
|
assert.match(tableModule, /Icon name="add-column"/);
|
|
assert.match(tableModule, /Icon name="remove-row"/);
|
|
assert.match(tableModule, /Icon name="remove-column"/);
|
|
assert.match(tableModule, /insertFormulaReferenceSelection/);
|
|
assert.match(tableModule, /startFormulaSelection/);
|
|
assert.match(tableModule, /copyTsv/);
|
|
assert.match(tableModule, /notepad-toolbar table-toolbar/);
|
|
assert.match(tableModule, /notepad-toolbar-group/);
|
|
assert.match(tableModule, /notepad-toolbar-button/);
|
|
assert.match(tableModule, /selection/);
|
|
assert.match(tableModule, /draggingSelectionRef/);
|
|
assert.match(tableModule, /movingSelectionRef/);
|
|
assert.match(tableModule, /copiedSelectionRef/);
|
|
assert.match(tableUtils, /moveSelectionCells/);
|
|
assert.match(tableUtils, /pasteCellBlock/);
|
|
assert.match(tableUtils, /parseTsvBlock/);
|
|
assert.match(tableGridParts, /is-move-target/);
|
|
assert.match(tableUtils, /isMultiCellSelection/);
|
|
assert.match(tableModule, /handleCellKeyDown/);
|
|
assert.match(tableModule, /clearSelection/);
|
|
assert.match(tableModule, /event\.key === "Delete"/);
|
|
assert.match(tableModule, /ArrowUp/);
|
|
assert.match(tableModule, /ArrowDown/);
|
|
assert.match(tableModule, /ArrowLeft/);
|
|
assert.match(tableModule, /ArrowRight/);
|
|
assert.match(tableGridParts, /export function HeaderLabelInput/);
|
|
assert.match(tableGridParts, /useInlineEdit/);
|
|
assert.match(tableModule, /TextExchangeActions/);
|
|
assert.match(tableGridParts, /event\.target\.select/);
|
|
assert.match(tableFormulaEngine, /export function evaluateTableCell/);
|
|
assert.doesNotMatch(tableFormulaEngine, /Function\(/);
|
|
assert.doesNotMatch(tableFormulaEngine, /\beval\(/);
|
|
assert.match(timerModule, /export function TimerModule/);
|
|
assert.match(timerModule, /Tabs/);
|
|
assert.match(timerModule, /stopwatch/);
|
|
assert.match(timerModule, /countdown/);
|
|
assert.match(timerModule, /useInlineEdit/);
|
|
assert.match(timerModule, /useDraftForm/);
|
|
assert.match(timerModule, /normalizeTimerData/);
|
|
assert.match(timerModule, /TextExchangeActions/);
|
|
assert.match(taskPlannerModule, /export function TaskPlannerModule/);
|
|
assert.match(taskPlannerModule, /normalizeTaskPlannerData/);
|
|
assert.match(taskPlannerModule, /applyDueResets/);
|
|
assert.match(taskPlannerModule, /TaskPlannerBranch/);
|
|
assert.match(taskPlannerModule, /useGroupedReorder/);
|
|
assert.match(taskPlannerModule, /useDraftForm/);
|
|
assert.match(taskPlannerModule, /TextExchangeActions/);
|
|
assert.match(taskPlannerModule, /reorderFeatures/);
|
|
assert.match(taskPlannerItems, /export function TaskPlannerBranch/);
|
|
assert.match(taskPlannerItems, /function TaskPlannerItem/);
|
|
assert.match(taskPlannerItems, /task-planner-warning/);
|
|
assert.match(taskPlannerItems, /useInlineEdit/);
|
|
assert.match(taskPlannerItems, /commitOnEnter: false/);
|
|
assert.match(taskPlannerItems, /categoryLabel/);
|
|
assert.match(taskPlannerItems, /prerequisite/);
|
|
assert.match(taskPlannerUtils, /export function getTaskParentMap/);
|
|
assert.match(taskPlannerUtils, /export function applyDueResets/);
|
|
assert.doesNotMatch(taskPlannerModule, /canMoveItem:/);
|
|
assert.doesNotMatch(taskPlannerModule, /canMoveGroup:/);
|
|
assert.match(equipmentPlannerModule, /export function EquipmentPlannerModule/);
|
|
assert.match(equipmentPlannerModule, /normalizeEquipmentPlannerData/);
|
|
assert.match(equipmentPlannerModule, /summarizeEquipmentPlannerData/);
|
|
assert.match(equipmentPlannerModule, /EquipmentItem/);
|
|
assert.match(equipmentPlannerModule, /EquipmentPlannerSummary/);
|
|
assert.match(equipmentPlannerEditors, /socketItems/);
|
|
assert.match(equipmentPlannerEditors, /socketLinks/);
|
|
assert.match(equipmentPlannerModule, /useGroupedReorder/);
|
|
assert.match(equipmentPlannerEditors, /reorderFeatures/);
|
|
assert.match(equipmentPlannerModule, /TextExchangeActions/);
|
|
assert.match(equipmentPlannerItem, /export function EquipmentItem/);
|
|
assert.match(equipmentPlannerPickers, /export function IconChoiceDropdown/);
|
|
assert.match(equipmentPlannerSummary, /export function EquipmentPlannerSummary/);
|
|
assert.match(equipmentPlannerOptions, /export const EQUIPMENT_ICONS/);
|
|
assert.match(equipmentPlannerOptions, /export function formatValue/);
|
|
assert.match(checklistModule, /export function ChecklistModule/);
|
|
assert.match(checklistModule, /TextExchangeActions/);
|
|
assert.match(checklistModule, /editing &&/);
|
|
assert.match(checklistModule, /ChecklistItem/);
|
|
assert.match(checklistModule, /ChecklistSection/);
|
|
assert.match(checklistModule, /chevron-down/);
|
|
assert.match(checklistModule, /chevron-up/);
|
|
assert.match(checklistModule, /checklist-qty-current/);
|
|
assert.match(checklistModule, /checklist-delete-button danger/);
|
|
assert.match(checklistModule, /useGroupedReorder/);
|
|
assert.match(checklistModule, /getItemProps/);
|
|
assert.match(checklistModule, /getGroupProps/);
|
|
assert.match(checklistModule, /getGroupBoundaryProps/);
|
|
assert.match(checklistModule, /checklist-category-boundary-drop-zone/);
|
|
assert.match(checklistModule, /itemReorder\.startDrag/);
|
|
assert.match(checklistModule, /groupReorder\.startDrag/);
|
|
assert.match(checklistModule, /useInlineEdit/);
|
|
assert.match(checklistModule, /moveChecklistItemToCategory/);
|
|
assert.match(textImportModal, /createPortal/);
|
|
assert.match(textImportModal, /lockBodyScroll/);
|
|
assert.match(textImportModal, /has-error/);
|
|
assert.match(textExchangeActions, /export function TextExchangeActions/);
|
|
assert.match(textExchangeActions, /Icon name="import"/);
|
|
assert.match(textExchangeActions, /Icon name="export"/);
|
|
assert.match(textExchangeActions, /useTextExchange/);
|
|
assert.match(textExchangeHook, /export function useTextExchange/);
|
|
assert.match(textExchangeHook, /importModuleText/);
|
|
assert.match(textExchangeHook, /exportModuleText/);
|
|
assert.match(imagesModule, /export function ImagesModule/);
|
|
assert.match(imagesModule, /useGroupedReorder/);
|
|
assert.match(imagesModule, /orientation: "horizontal"/);
|
|
assert.match(imagesModule, /editing &&/);
|
|
assert.match(imagesModule, /clipboardData/);
|
|
assert.match(imagesModule, /createImageAnnotationModule/);
|
|
assert.match(imagesModule, /TextExchangeActions/);
|
|
assert.match(imagesModule, /image-annotate-button/);
|
|
assert.match(imagesModule, /dataTransfer\.files/);
|
|
assert.match(imageAnnotationModule, /export function ImageAnnotationModule/);
|
|
assert.match(imageAnnotationModule, /annotation-marker/);
|
|
assert.match(imageAnnotationModule, /setImageFromFiles/);
|
|
assert.match(imageAnnotationModule, /context\.compressImageFile/);
|
|
assert.match(imageAnnotationModule, /context\.setImage/);
|
|
assert.match(imageAnnotationModule, /createMarkerId/);
|
|
assert.match(imageAnnotationModule, /<Icon name="zoom"/);
|
|
assert.match(imageAnnotationModule, /TextExchangeActions/);
|
|
assert.match(linksModule, /export function LinksModule/);
|
|
assert.match(linksModule, /TextExchangeActions/);
|
|
assert.match(linksModule, /editing &&/);
|
|
assert.match(linksModule, /normalizeUrl/);
|
|
assert.match(linksModule, /copyText/);
|
|
assert.match(linksModule, /useGroupedReorder/);
|
|
assert.match(linksModule, /useDraftForm/);
|
|
assert.match(linksModule, /linkDraft\.getFieldProps/);
|
|
assert.match(linksModule, /link-drag-handle/);
|
|
assert.match(countersModule, /export function CountersModule/);
|
|
assert.match(countersModule, /editing &&/);
|
|
assert.match(countersModule, /counter-actions/);
|
|
assert.match(countersModule, /useGroupedReorder/);
|
|
assert.match(countersModule, /useDraftForm/);
|
|
assert.match(countersModule, /counterDraft\.getFieldProps/);
|
|
assert.match(countersModule, /orientation: "horizontal"/);
|
|
assert.match(countersModule, /counter-drag-handle/);
|
|
assert.match(countersModule, /TextExchangeActions/);
|
|
assert.match(timerModule, /useGroupedReorder/);
|
|
assert.match(timerModule, /reorderEnabled={!data\.sortResults}/);
|
|
assert.match(timerModule, /parentId=\{moduleId\}/);
|
|
assert.match(timerModule, /timer-drag-handle/);
|
|
assert.match(textImport, /export function parseColonImportLines/);
|
|
assert.match(textImport, /export function exportModuleText/);
|
|
assert.match(textImport, /export function importModuleText/);
|
|
assert.match(textImport, /export function hasTextExchangeContent/);
|
|
assert.match(textImport, /line\.indexOf\(":"\)/);
|
|
assert.match(imageViewer, /image-viewer-media/);
|
|
assert.match(imageViewer, /image-viewer-image-frame/);
|
|
assert.match(imageViewer, /image-viewer-marker/);
|
|
assert.match(imageViewer, /function openImageInNewTab/);
|
|
assert.match(imageViewer, /!hasMarkers &&/);
|
|
assert.match(imageViewer, /<Icon name="zoom"/);
|
|
assert.match(imageViewer, /annotation-marker-list themed-scrollbar/);
|
|
});
|
|
|
|
test("task planner helpers keep hierarchy, reorder and reset behavior stable", () => {
|
|
const tasks = [
|
|
{ id: "a", title: "A", type: "daily", checked: true, checkedAt: Date.UTC(2026, 0, 1, 7) },
|
|
{ id: "b", title: "B", type: "unique", checked: false },
|
|
{ id: "c", title: "C", type: "weekly", checked: true, checkedAt: Date.UTC(2026, 0, 1, 7) }
|
|
];
|
|
const relations = [{ id: "r1", fromTaskId: "b", toTaskId: "a", prerequisite: false }];
|
|
const parentMap = getTaskParentMap(tasks, relations);
|
|
|
|
assert.equal(parentMap.get("b"), "a");
|
|
assert.deepEqual(getTaskTreeIds(["a"], tasks, parentMap), ["a", "b"]);
|
|
assert.deepEqual(moveTask(tasks, "c", "a").map((task) => task.id), ["c", "a", "b"]);
|
|
|
|
const resetData = applyDueResets({
|
|
tasks,
|
|
relations,
|
|
resetTime: "06:00",
|
|
weeklyResetDay: 4,
|
|
categoryOrder: [],
|
|
lastResetAt: Date.UTC(2026, 0, 1, 5)
|
|
}, Date.UTC(2026, 0, 2, 8));
|
|
assert.equal(resetData.tasks.find((task) => task.id === "a").checked, false);
|
|
});
|
|
|
|
test("equipment planner options expose stable formatting and socket helpers", () => {
|
|
assert.deepEqual(SOCKET_SHAPES, ["ball", "jewel"]);
|
|
assert.equal(formatValue(1.23456), "1.235");
|
|
assert.deepEqual(setItemCategory({ id: "item" }, "DPS"), { id: "item", category: "DPS" });
|
|
assert.deepEqual(setItemCategory({ id: "item", category: "DPS" }, ""), { id: "item" });
|
|
assert.equal(getSocketItemName({ socketItems: [{ id: "gem", name: "Ruby" }] }, "gem"), "Ruby");
|
|
});
|
|
|
|
test("combos helpers keep labels, hold parsing and custom keys stable", () => {
|
|
assert.deepEqual(createInput("button", "a", 1500), { kind: "button", value: "a", holdMs: 1500 });
|
|
assert.deepEqual(createInput("button", "a"), { kind: "button", value: "a" });
|
|
assert.equal(getInputLabel({ kind: "key", value: "q" }), "Q");
|
|
assert.equal(getInputLabel({ kind: "mouse", value: "left" }), "Clic G");
|
|
assert.equal(parseHoldSeconds("120s"), 99);
|
|
assert.equal(parseHoldSeconds("abc"), 0);
|
|
assert.equal(normalizeCustomKey(" Ctrl Alt Shift "), "Ctrl Alt Shift");
|
|
});
|
|
|
|
test("table helpers keep selection, movement and TSV behavior stable", () => {
|
|
const selection = {
|
|
anchor: { rowIndex: 2, columnIndex: 3 },
|
|
focus: { rowIndex: 1, columnIndex: 1 }
|
|
};
|
|
assert.deepEqual(getSelectionBounds(selection), {
|
|
startRow: 1,
|
|
endRow: 2,
|
|
startColumn: 1,
|
|
endColumn: 3
|
|
});
|
|
assert.deepEqual(parseTsvBlock("A\tB\nC\tD"), {
|
|
height: 2,
|
|
width: 2,
|
|
values: [["A", "B"], ["C", "D"]]
|
|
});
|
|
|
|
const moved = moveSelectionCells({ A1: "a", B1: "b", A2: "c" }, getBoundsFromStartAndSize(0, 0, 1, 2), getBoundsFromStartAndSize(1, 1, 1, 2));
|
|
assert.deepEqual(moved, { A2: "c", B2: "a", C2: "b" });
|
|
|
|
const pasted = pasteCellBlock({}, parseTsvBlock("A\t\nC\tD"), 0, 0, 2, 2);
|
|
assert.deepEqual(pasted.cells, { A1: "A", A2: "C", B2: "D" });
|
|
});
|