Refactor notepad toolbar 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
61176ba9b7
commit
c2e37ad3f2
5 changed files with 234 additions and 173 deletions
|
|
@ -139,6 +139,8 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
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 notepadToolbar = await readFile("website/src/features/toolboxes/modules/NotepadToolbar.jsx", "utf8");
|
||||
const notepadUtils = await readFile("website/src/features/toolboxes/modules/notepadUtils.js", "utf8");
|
||||
const combosModule = await readFile("website/src/features/toolboxes/modules/CombosModule.jsx", "utf8");
|
||||
const combosEditor = await readFile("website/src/features/toolboxes/modules/CombosEditor.jsx", "utf8");
|
||||
const combosParts = await readFile("website/src/features/toolboxes/modules/CombosParts.jsx", "utf8");
|
||||
|
|
@ -252,6 +254,11 @@ test("toolbox module registry and modules expose expected behavior", async () =>
|
|||
assert.match(notepadModule, /export function NotepadModule/);
|
||||
assert.match(notepadModule, /TextExchangeActions/);
|
||||
assert.match(notepadModule, /type="notepad"/);
|
||||
assert.match(notepadToolbar, /export function NotepadToolbar/);
|
||||
assert.match(notepadToolbar, /FormattingColorDropdown/);
|
||||
assert.match(notepadToolbar, /ListTypeDropdown/);
|
||||
assert.match(notepadUtils, /export function getPlainText/);
|
||||
assert.match(notepadUtils, /export function restoreSelectionTextOffset/);
|
||||
assert.match(combosModule, /export function CombosModule/);
|
||||
assert.match(combosUtils, /keyboardMouse/);
|
||||
assert.match(combosUtils, /Nintendo 64/);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { calculateExpression, createStoredFormula, evaluateCalculatorEntries, ge
|
|||
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 { appendChecklistItems, moveChecklistItem, moveChecklistItemToCategory, renameChecklistSection } from "../website/src/features/toolboxes/modules/checklistUtils.js";
|
||||
import { formatUpdatedAt, isHtmlEmpty, queryBlockFormat, queryCommandState } from "../website/src/features/toolboxes/modules/notepadUtils.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";
|
||||
|
|
@ -125,6 +126,16 @@ test("text exchange round trips simple toolbox modules and resets checklist prog
|
|||
assert.deepEqual(countersImport.data.counters.map((counter) => [counter.label, counter.value]), [["Win", 12], ["Loss", -2]]);
|
||||
});
|
||||
|
||||
test("notepad helpers keep empty html and invalid command states stable", () => {
|
||||
assert.equal(isHtmlEmpty("<p><br></p>", ""), true);
|
||||
assert.equal(isHtmlEmpty("<p> </p>", ""), true);
|
||||
assert.equal(isHtmlEmpty("<p>Hello</p>", "Hello"), false);
|
||||
assert.equal(formatUpdatedAt("not-a-date"), "");
|
||||
assert.match(formatUpdatedAt("2026-08-14T10:30:00.000Z"), /\d/);
|
||||
assert.equal(queryCommandState("bold"), false);
|
||||
assert.equal(queryBlockFormat(), "");
|
||||
});
|
||||
|
||||
test("text exchange imports table TSV and calculator hierarchy", () => {
|
||||
const context = createTextImportContext();
|
||||
const tableImport = importModuleText("table", "@size: 2x2\n@columns: Item\tTotal\n@rows: One\tTwo\n@tsv\nPotion\t=A1\nMega\t5", context);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue