mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Merge pull request #815 from prymitive/fix-warning
fix(ui): fix warning progress bar in overview modal
This commit is contained in:
@@ -20,7 +20,7 @@ exports[`<MountedLabelWithPercent /> matches snapshot 1`] = `
|
||||
</span>
|
||||
</span>
|
||||
<div class=\\"progress silence-progress bg-white pr-1\\">
|
||||
<div class=\\"progress-bar bg-success\\"
|
||||
<div class=\\"progress-bar bg-warning\\"
|
||||
role=\\"progressbar\\"
|
||||
style=\\"width: 50%;\\"
|
||||
aria-valuenow=\\"50\\"
|
||||
|
||||
@@ -32,7 +32,7 @@ const LabelWithPercent = inject("alertStore")(
|
||||
const progressBarBg =
|
||||
percent > 66
|
||||
? "bg-danger"
|
||||
: percent > 66
|
||||
: percent > 33
|
||||
? "bg-warning"
|
||||
: "bg-success";
|
||||
|
||||
|
||||
@@ -60,4 +60,43 @@ describe("<MountedLabelWithPercent />", () => {
|
||||
NewUnappliedFilter("foo!=bar")
|
||||
);
|
||||
});
|
||||
|
||||
it("uses bg-danger when percent is >66", () => {
|
||||
const tree = mount(
|
||||
<LabelWithPercent
|
||||
alertStore={alertStore}
|
||||
name={"foo"}
|
||||
value={"bar"}
|
||||
hits={25}
|
||||
percent={67}
|
||||
/>
|
||||
);
|
||||
expect(tree.html()).toMatch(/progress-bar bg-danger/);
|
||||
});
|
||||
|
||||
it("uses bg-warning when percent is >33", () => {
|
||||
const tree = mount(
|
||||
<LabelWithPercent
|
||||
alertStore={alertStore}
|
||||
name={"foo"}
|
||||
value={"bar"}
|
||||
hits={25}
|
||||
percent={66}
|
||||
/>
|
||||
);
|
||||
expect(tree.html()).toMatch(/progress-bar bg-warning/);
|
||||
});
|
||||
|
||||
it("uses bg-success when percent is <=33", () => {
|
||||
const tree = mount(
|
||||
<LabelWithPercent
|
||||
alertStore={alertStore}
|
||||
name={"foo"}
|
||||
value={"bar"}
|
||||
hits={25}
|
||||
percent={33}
|
||||
/>
|
||||
);
|
||||
expect(tree.html()).toMatch(/progress-bar bg-success/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ exports[`<OverviewModalContent /> matches snapshot with labels to show 1`] = `
|
||||
</span>
|
||||
</span>
|
||||
<div class=\\"progress silence-progress bg-white pr-1\\">
|
||||
<div class=\\"progress-bar bg-success\\"
|
||||
<div class=\\"progress-bar bg-warning\\"
|
||||
role=\\"progressbar\\"
|
||||
style=\\"width: 50%;\\"
|
||||
aria-valuenow=\\"50\\"
|
||||
|
||||
Reference in New Issue
Block a user