test(editor): make the detach-tab save-failure document dirty (#924)

Since #920, saves skip clean documents, so the detach-tab save-failure test never reached its mocked failing save. The test now edits the document first, keeping its intent: a failing save keeps the tab and opens no window.

Co-authored-by: a-rookie-of-C-language <[email protected]>
Цей коміт міститься в:
arookieofcтаa-rookie-of-C-language authored and GitHub committed 2026-11-03 08:31:19 +08:00
1 джерело 0a24b79b50
коміт 416b65d65e
1 file changed
+3
+3
Переглянути файл
@@ -82,6 +82,9 @@ describe("detachTab", () => {
ctrl.start();
await ctrl.openFile(path, { focus: false });
const [pane, id] = current();
// Clean documents skip saving entirely, so the document must be dirty for
// the mocked save failure to be reached.
ctrl.slotFor(id)!.dispatchLocal({ changes: { from: 0, to: 8, insert: "edited" } });
vi.spyOn(backend, "save").mockRejectedValue(new Error("save failed"));
expect(await ctrl.detachTab(pane, id)).toBe(false);
expect(hasTab(id)).toBe(true);