fix(desktop): keep update download active on dismiss

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-08-13 19:27:55 +08:00
1 parent 68c22e878b
commit fbf240efbc
2 files changed
+28 -2

No files matched your search

+23
View File
@@ -119,6 +119,11 @@ async function pressEscape() {
await flushDialog();
}
async function clickOutside() {
document.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, cancelable: true }));
await flushDialog();
}
afterEach(() => {
for (const app of mountedApps.splice(0)) app.unmount();
document.body.innerHTML = "";
@@ -202,6 +207,24 @@ describe("UpdateDialog close protection", () => {
expect(state.open).toBe(false);
});
it("keeps downloading in the background when the dialog is dismissed by clicking outside", async () => {
const { state, cancelDownload } = await mountDialog(0, { isDownloadingUpdate: true, downloadProgress: 42 });
await clickOutside();
expect(cancelDownload).not.toHaveBeenCalled();
expect(state.open).toBe(true);
});
it("keeps downloading in the background when the dialog is dismissed with Escape", async () => {
const { state, cancelDownload } = await mountDialog(0, { isDownloadingUpdate: true, downloadProgress: 42 });
await pressEscape();
expect(cancelDownload).not.toHaveBeenCalled();
expect(state.open).toBe(true);
});
it("allows closing while a downloaded update is idle", async () => {
const { state } = await mountDialog(0, { updateDownloaded: true, downloadProgress: 100 });