From 3b2ed27e25840aadf41a0ec55b1dc0924925a366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 11 Jul 2019 10:22:30 +0100 Subject: [PATCH 1/2] fix(ui): fix warning progress bar in overview modal --- .../Labels/LabelWithPercent/__snapshots__/index.test.js.snap | 2 +- ui/src/Components/Labels/LabelWithPercent/index.js | 2 +- .../__snapshots__/OverviewModalContent.test.js.snap | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/Components/Labels/LabelWithPercent/__snapshots__/index.test.js.snap b/ui/src/Components/Labels/LabelWithPercent/__snapshots__/index.test.js.snap index d87242fe6..1166f3198 100644 --- a/ui/src/Components/Labels/LabelWithPercent/__snapshots__/index.test.js.snap +++ b/ui/src/Components/Labels/LabelWithPercent/__snapshots__/index.test.js.snap @@ -20,7 +20,7 @@ exports[` matches snapshot 1`] = `
-
66 ? "bg-danger" - : percent > 66 + : percent > 33 ? "bg-warning" : "bg-success"; diff --git a/ui/src/Components/OverviewModal/__snapshots__/OverviewModalContent.test.js.snap b/ui/src/Components/OverviewModal/__snapshots__/OverviewModalContent.test.js.snap index c1647fe93..e3b8fdc7b 100644 --- a/ui/src/Components/OverviewModal/__snapshots__/OverviewModalContent.test.js.snap +++ b/ui/src/Components/OverviewModal/__snapshots__/OverviewModalContent.test.js.snap @@ -52,7 +52,7 @@ exports[` matches snapshot with labels to show 1`] = `
-
Date: Thu, 11 Jul 2019 10:59:35 +0100 Subject: [PATCH 2/2] fix(ui): add missing tests --- .../Labels/LabelWithPercent/index.test.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ui/src/Components/Labels/LabelWithPercent/index.test.js b/ui/src/Components/Labels/LabelWithPercent/index.test.js index 8d2a8e18f..9cbac15c9 100644 --- a/ui/src/Components/Labels/LabelWithPercent/index.test.js +++ b/ui/src/Components/Labels/LabelWithPercent/index.test.js @@ -60,4 +60,43 @@ describe("", () => { NewUnappliedFilter("foo!=bar") ); }); + + it("uses bg-danger when percent is >66", () => { + const tree = mount( + + ); + expect(tree.html()).toMatch(/progress-bar bg-danger/); + }); + + it("uses bg-warning when percent is >33", () => { + const tree = mount( + + ); + expect(tree.html()).toMatch(/progress-bar bg-warning/); + }); + + it("uses bg-success when percent is <=33", () => { + const tree = mount( + + ); + expect(tree.html()).toMatch(/progress-bar bg-success/); + }); });