fix(desktop): stabilize update download button width

This commit is contained in:
二丫讲梵 2026-07-31 16:23:40 +08:00 committed by GitHub
parent 7eb18fb3a8
commit 24691ccb1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -172,6 +172,19 @@ describe("UpdateDialog active task guard", () => {
});
});
describe("UpdateDialog download progress", () => {
it("keeps the downloading button at a fixed width as progress changes", async () => {
const { state } = await mountDialog(0, { isDownloadingUpdate: true, downloadProgress: 9 });
expect(buttonWithText("Downloading 9%")?.classList.contains("w-52")).toBe(true);
state.downloadProgress = 100;
await flushDialog();
expect(buttonWithText("Downloading 100%")?.classList.contains("w-52")).toBe(true);
});
});
describe("UpdateDialog close protection", () => {
it("cancels the background download when the close button is clicked", async () => {
const { state, cancelDownload } = await mountDialog(0, { isDownloadingUpdate: true, downloadProgress: 42 });

View File

@ -144,7 +144,7 @@ watch(
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("updates.installing") }}
</Button>
<Button v-else-if="isDownloadingUpdate" disabled>
<Button v-else-if="isDownloadingUpdate" class="w-52" disabled>
<Loader2 class="h-4 w-4 animate-spin" />
{{ t("updates.downloading", { progress: downloadProgress }) }}
</Button>