mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Round percentage of update download progress in tray
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
152769e0d8
commit
e9af27103b
@ -154,12 +154,12 @@ describe("installing update using tray", () => {
|
|||||||
).toBe("Downloading update some-version (0%)...");
|
).toBe("Downloading update some-version (0%)...");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("when download progresses, percentage increases", () => {
|
it("when download progresses with decimals, percentage increases as integers", () => {
|
||||||
const progressOfUpdateDownload = applicationBuilder.dis.mainDi.inject(
|
const progressOfUpdateDownload = applicationBuilder.dis.mainDi.inject(
|
||||||
progressOfUpdateDownloadInjectable,
|
progressOfUpdateDownloadInjectable,
|
||||||
);
|
);
|
||||||
|
|
||||||
progressOfUpdateDownload.set({ percentage: 42 });
|
progressOfUpdateDownload.set({ percentage: 42.424242 });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||||
|
|||||||
@ -41,7 +41,9 @@ const checkForUpdatesTrayItemInjectable = getInjectable({
|
|||||||
|
|
||||||
assert(discoveredVersion);
|
assert(discoveredVersion);
|
||||||
|
|
||||||
return `Downloading update ${discoveredVersion.version} (${progressOfUpdateDownload.value.get().percentage}%)...`;
|
const roundedPercentage = Math.round(progressOfUpdateDownload.value.get().percentage);
|
||||||
|
|
||||||
|
return `Downloading update ${discoveredVersion.version} (${roundedPercentage}%)...`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkingForUpdatesState.value.get()) {
|
if (checkingForUpdatesState.value.get()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user