1
0
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:
Janne Savolainen 2022-06-02 11:20:37 +03:00
parent 152769e0d8
commit e9af27103b
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A
2 changed files with 5 additions and 3 deletions

View File

@ -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(),

View File

@ -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()) {