feat(downloads): explain unknown remaining sizes

This commit is contained in:
Sucukdeluxe
2026-08-21 01:06:03 +02:00
parent 869dbc25be
commit 8fb92caa30
7 changed files with 53 additions and 4 deletions
+18
View File
@@ -10,6 +10,7 @@ import {
buildDownloadsViewModel,
classifyDownloadStatus,
formatRemainingDownloadBytes,
formatRemainingDownloadTooltip,
getDownloadQueueTotalBytes,
getRemainingDownloadBytes,
getPendingDownloadItemCount,
@@ -248,6 +249,22 @@ describe("verbleibendes Downloadvolumen", () => {
expect(formatRemainingDownloadBytes({ bytes: 750_000_000, unknownItems: 1 })).toBe("≥ 715.26 MB");
expect(formatRemainingDownloadBytes({ bytes: 0, unknownItems: 1 })).toBe("Unbekannt");
expect(formatRemainingDownloadBytes({ bytes: 0, unknownItems: 0 })).toBe("0 B");
expect(formatRemainingDownloadTooltip({ bytes: 750_000_000, unknownItems: 1 }))
.toBe("Noch unbekannte Dateigrößen: 1. Die tatsächliche Restmenge kann höher sein.");
expect(formatRemainingDownloadTooltip({ bytes: 0, unknownItems: 0 })).toBe("");
});
it("erklärt unbekannte Restgrößen direkt am verbleibenden Wert", () => {
const model = withRuntime(createInput());
model.status.remaining = "≥ 715.26 MB";
model.status.remainingTooltip = "Noch unbekannte Dateigrößen: 2. Die tatsächliche Restmenge kann höher sein.";
const html = renderToStaticMarkup(<DownloadsSidebarStatus model={model} />);
expect(html).toContain('class="has-tooltip"');
expect(html).toContain('title="Noch unbekannte Dateigrößen: 2. Die tatsächliche Restmenge kann höher sein."');
expect(html).toContain('aria-describedby="downloads-status-remaining-tooltip"');
expect(html).toContain('class="downloads-visually-hidden"');
});
});
@@ -766,6 +783,7 @@ function withRuntime(input: DownloadsModelInput, overrides: Record<string, unkno
totalBytes: 10_000_000_000,
remaining: "6,50 GB",
remainingBytes: 6_500_000_000,
remainingTooltip: "",
hosters: 3,
speed: "96,00 Mbit/s",
eta: "00:05:00"
+2
View File
@@ -75,6 +75,8 @@ describe("renderer localization", () => {
expect(translateUiText("Klicken zum Kopieren", "en")).toBe("Click to copy");
expect(translateUiText("Geprüft", "en")).toBe("Checked");
expect(translateUiText("gerade eben", "en")).toBe("just now");
expect(translateUiText("Noch unbekannte Dateigrößen: 3. Die tatsächliche Restmenge kann höher sein.", "en"))
.toBe("Unknown file sizes: 3. The actual remaining amount may be higher.");
expect(translateUiText("Geschwindigkeit verschieben", "en")).toBe("Move Speed");
expect(translateUiText("Geschwindigkeit nach links verschieben", "en")).toBe("Move Speed left");
expect(translateUiText("Move Speed right", "de")).toBe("Geschwindigkeit nach rechts verschieben");