fix(forge): ne plus ecraser une completion acceptee au Tab (BUG-055)
This commit is contained in:
@@ -275,14 +275,23 @@ test("utils.js detachInlineEditor tears the session down without re-rendering",
|
||||
});
|
||||
|
||||
test("utils.js reloads the displayed document after an AI write", () => {
|
||||
const fn = utilsSrc.match(/async function reloadExternalWrite\(vault, path\) \{([\s\S]*?)\n\}/);
|
||||
const fn = utilsSrc.match(/async function reloadExternalWrite\(vault, path, force = false\) \{([\s\S]*?)\n\}/);
|
||||
assert.ok(fn, "reloadExternalWrite not found");
|
||||
assert.match(fn[1], /postMessage\(\{ type: 'parent-reload' \}, '\*'\)/);
|
||||
assert.match(fn[1], /postMessage\(\{ type: 'parent-reload', force: !!force \}, '\*'\)/);
|
||||
assert.match(fn[1], /suppressAutoSaveOnce = true;/);
|
||||
assert.match(utilsSrc, /window\.addEventListener\("obsigate:file-written"/);
|
||||
assert.match(utilsSrc, /if \(suppressAutoSaveOnce\) \{/, "autosave skipped on programmatic reload");
|
||||
});
|
||||
|
||||
test("utils.js does not clobber unsaved edits on a non-forced reload (BUG-055)", () => {
|
||||
const fn = utilsSrc.match(/async function reloadExternalWrite\(vault, path, force = false\) \{([\s\S]*?)\n\}/);
|
||||
assert.ok(fn, "reloadExternalWrite not found");
|
||||
// Guard before the CodeMirror dispatch
|
||||
assert.match(fn[1], /if \(!force && dirtyDot && dirtyDot\.classList\.contains\("dirty"\)\) return;/);
|
||||
// The AI write forces the reload past unsaved local changes
|
||||
assert.match(utilsSrc, /reloadExternalWrite\(detail\.vault, detail\.path, true\);/);
|
||||
});
|
||||
|
||||
test("sync.js forge-close goes through the shared close path", () => {
|
||||
assert.ok(syncSrc.includes("import { closeEditor, reloadExternalWrite } from './utils.js';"), "utils import missing");
|
||||
const handler = syncSrc.match(/if \(e\.data\.type === 'forge-close'\) \{([\s\S]*?)\n \}/);
|
||||
|
||||
Reference in New Issue
Block a user