Refactor calculator module helpers
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s

This commit is contained in:
Shinuwa 2026-08-24 23:08:26 +02:00
parent e512eef232
commit 61176ba9b7
5 changed files with 211 additions and 170 deletions

View file

@ -146,6 +146,9 @@ test("toolbox module registry and modules expose expected behavior", async () =>
const combosBundle = `${combosModule}\n${combosEditor}\n${combosParts}\n${combosList}`;
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 calculatorEntries = await readFile("website/src/features/toolboxes/modules/CalculatorEntries.jsx", "utf8");
const calculatorUtils = await readFile("website/src/features/toolboxes/modules/calculatorUtils.js", "utf8");
const calculatorBundle = `${calculatorModule}\n${calculatorEntries}\n${calculatorUtils}`;
const tableModule = await readFile("website/src/features/toolboxes/modules/TableModule.jsx", "utf8");
const tableGrid = await readFile("website/src/features/toolboxes/modules/TableGrid.jsx", "utf8");
const tableGridParts = await readFile("website/src/features/toolboxes/modules/TableGridParts.jsx", "utf8");
@ -274,12 +277,12 @@ test("toolbox module registry and modules expose expected behavior", async () =>
assert.doesNotMatch(combosModule, /canMoveItem:/);
assert.doesNotMatch(combosModule, /canMoveGroup:/);
assert.match(calculatorModule, /export function CalculatorModule/);
assert.match(calculatorModule, /calculateExpression/);
assert.match(calculatorUtils, /export function calculateExpression/);
assert.match(calculatorModule, /activeParentId/);
assert.match(calculatorModule, /parentId/);
assert.match(calculatorModule, /MixTagsInput/);
assert.match(calculatorModule, /useGroupedReorder/);
assert.match(calculatorModule, /calculator-drag-handle/);
assert.match(calculatorEntries, /calculator-drag-handle/);
assert.match(calculatorModule, /scrollResults/);
assert.match(calculatorModule, /tool-split-scroll-toggle/);
assert.match(calculatorModule, /copyChecklistImport/);
@ -293,11 +296,11 @@ test("toolbox module registry and modules expose expected behavior", async () =>
assert.match(calculatorModule, /setExpression\(BASE_TOKEN\)/);
assert.match(calculatorModule, /editingEntryId/);
assert.match(calculatorModule, /updateButton/);
assert.match(calculatorModule, /onAddChild/);
assert.match(calculatorModule, /entry\.label \|\| formatResult\(entry\.value\)/);
assert.match(calculatorEntries, /onAddChild/);
assert.match(calculatorEntries, /entry\.label \|\| formatResult\(entry\.value\)/);
assert.match(calculatorModule, /ResizeObserver/);
assert.match(calculatorModule, /--calculator-scroll-height/);
assert.match(calculatorModule, /CalculatorEntries/);
assert.match(calculatorBundle, /CalculatorEntries/);
assert.match(tableModule, /export function TableModule/);
assert.match(tableBundle, /Icon name="add-row"/);
assert.match(tableBundle, /Icon name="add-column"/);