Extract combos module helpers
This commit is contained in:
parent
fb5feb8c98
commit
df0033739c
4 changed files with 359 additions and 331 deletions
|
|
@ -4,6 +4,7 @@ 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";
|
||||
|
||||
test("toolbox storage, cards and pages are wired", async () => {
|
||||
const source = await readFile("website/src/main.jsx", "utf8");
|
||||
|
|
@ -114,6 +115,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
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 tableFormulaEngine = await readFile("website/src/features/toolboxes/modules/tableFormulaEngine.js", "utf8");
|
||||
|
|
@ -180,26 +183,26 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(notepadModule, /TextExchangeActions/);
|
||||
assert.match(notepadModule, /type="notepad"/);
|
||||
assert.match(combosModule, /export function CombosModule/);
|
||||
assert.match(combosModule, /keyboardMouse/);
|
||||
assert.match(combosModule, /Nintendo 64/);
|
||||
assert.match(combosModule, /ComboInputToken/);
|
||||
assert.match(combosModule, /ComboSequence/);
|
||||
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(combosModule, /SPECIAL_INPUT_GROUP/);
|
||||
assert.match(combosModule, /grab/);
|
||||
assert.match(combosModule, /protect/);
|
||||
assert.match(combosModule, /shoot/);
|
||||
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(combosModule, /useInlineEdit/);
|
||||
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(combosModule, /function setComboItemCategory/);
|
||||
assert.match(combosUtils, /function setComboItemCategory/);
|
||||
assert.match(combosModule, /setItemGroup: setComboItemCategory/);
|
||||
assert.doesNotMatch(combosModule, /canMoveItem:/);
|
||||
assert.doesNotMatch(combosModule, /canMoveGroup:/);
|
||||
|
|
@ -411,3 +414,13 @@ test("equipment planner options expose stable formatting and socket helpers", ()
|
|||
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");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue