fix(editor): le bouton Sauvegarder ne reste plus bloque sur le spinner (BUG-054)
CI / lint (push) Successful in 1m45s
CI / security (push) Successful in 1m1s
CI / test (push) Successful in 2m55s
CI / build (push) Successful in 57s
CI / e2e (push) Successful in 10m48s

This commit is contained in:
2026-09-17 08:00:13 -04:00
parent f02174af57
commit 23a3c147cd
12 changed files with 83 additions and 14 deletions
+25
View File
@@ -356,6 +356,31 @@ test("style.css: #editor-body scrolls through the CodeMirror scroller only", ()
"global .cm-scroller min-height override reintroduces the double scrollbar");
});
// ── BUG-054: the shared save button must not stay stuck on the spinner ──
test("utils.js resetSaveButton restores the checkmark and re-enables the button", () => {
const fn = utilsSrc.match(/function resetSaveButton\(\) \{([\s\S]*?)\n\}/);
assert.ok(fn, "resetSaveButton not found");
assert.match(fn[1], /saveBtn\.disabled = false;/);
assert.match(fn[1], /saveBtn\.innerHTML = '✓'/);
assert.match(fn[1], /saveBtn\.style\.background = '';/);
});
test("utils.js openEditor resets the save button before each session", () => {
const fn = utilsSrc.match(/async function openEditor\(vaultName, filePath\) \{([\s\S]*?)\n\}/);
assert.ok(fn, "openEditor not found");
assert.match(fn[1], /resetSaveButton\(\);/);
});
test("utils.js closeEditor resets the save button on success/cancel/delete", () => {
const fn = utilsSrc.match(/function closeEditor\(\) \{([\s\S]*?)\n\}/);
assert.ok(fn, "closeEditor not found");
assert.match(fn[1], /resetSaveButton\(\);/);
});
test("utils.js saveFile restores the save button when the request fails", () => {
assert.match(utilsSrc, /console\.error\("Save error:", err\);\s*\n\s*resetSaveButton\(\);/);
});
console.log(`\n${testCount - failCount}/${testCount} tests passed`);
if (failCount > 0) {
console.error(`${failCount} test(s) failed`);