fix(editor): le bouton Sauvegarder ne reste plus bloque sur le spinner (BUG-054)
This commit is contained in:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user