From f08dea2c47f40ead80c358b3d4db0546a796eb93 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Sat, 20 May 2023 16:07:24 +0200 Subject: [PATCH] Show guard disable timer (#8100) --- assets/js/components/VehicleStatus.test.js | 23 ++++++++++++++++++---- assets/js/components/VehicleStatus.vue | 8 ++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/assets/js/components/VehicleStatus.test.js b/assets/js/components/VehicleStatus.test.js index d4eb1190a..2a4d7b76e 100644 --- a/assets/js/components/VehicleStatus.test.js +++ b/assets/js/components/VehicleStatus.test.js @@ -134,23 +134,38 @@ describe("timer", () => { test("show guard timer if it exists", () => { expectStatus( { - guardAction: "enable", connected: true, + guardAction: "enable", guardRemainingInterpolated: 90, }, "guard", { remaining: "1:30m" } ); }); - test("don't show guard timer if charging", () => { + test("don't show guard timer if another timer exists", () => { expectStatus( { - guardAction: "enable", connected: true, charging: true, + pvAction: "disable", + pvRemainingInterpolated: 30, + guardAction: "enable", guardRemainingInterpolated: 90, }, - "charging" + "pvDisable", + { remaining: "30s" } + ); + }); + test("show guard timer if charging and no other timer exists", () => { + expectStatus( + { + connected: true, + charging: true, + guardAction: "enable", + guardRemainingInterpolated: 90, + }, + "guard", + { remaining: "1:30m" } ); }); }); diff --git a/assets/js/components/VehicleStatus.vue b/assets/js/components/VehicleStatus.vue index 4755cc0fd..0798c816c 100644 --- a/assets/js/components/VehicleStatus.vue +++ b/assets/js/components/VehicleStatus.vue @@ -116,16 +116,16 @@ export default { }); } - if (this.charging) { - return t("charging"); - } - if (this.guardTimerActive) { return t("guard", { remaining: this.fmtShortDuration(this.guardRemainingInterpolated, true), }); } + if (this.charging) { + return t("charging"); + } + return t("connected"); }, },