Skip to content

Commit 37a237a

Browse files
committed
refac: legend usage in code
1 parent 619ba51 commit 37a237a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/components/VueEllipseProgress.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
<div class="ep-legend--container" :style="{ maxWidth: `${size}px` }">
1212
<div
1313
class="ep-legend--value"
14-
v-if="legend && !isMultiple"
14+
v-if="!hideLegend && !isMultiple"
1515
:class="[legendClass, { 'ep-hidden': shouldHideLegendValue }]"
1616
:style="{ fontSize, color: fontColor }"
1717
>
18-
<counter :value="legendVal" :animation="normalizedCircles[0].animation" :loading="loading">
18+
<counter :value="computedLegend" :animation="normalizedCircles[0].animation" :loading="loading">
1919
<template v-slot:default="{ counterTick }">
2020
<span v-if="legendFormatter">
2121
<span v-if="isHTML" v-html="legendFormatter(counterTick)"></span>
@@ -49,11 +49,11 @@ export default {
4949
counterTick: {},
5050
}),
5151
computed: {
52-
legendVal() {
52+
computedLegend() {
5353
if (this.loading || this.noData) {
5454
return 0;
5555
}
56-
return this.legendValue ? this.legendValue : getNumberIfValid(this.progress) || 0;
56+
return this.legend ? this.legend : getNumberIfValid(this.progress) || 0;
5757
},
5858
shouldHideLegendValue() {
5959
return !this.isDataAvailable || this.loading;

src/components/interface.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const options = {
9595
hideLegend: {
9696
type: Boolean,
9797
required: false,
98-
default: true,
98+
default: false,
9999
},
100100
legendClass: {
101101
type: String,

tests/unit/container.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("[ EllipseProgressContainer.vue ]", () => {
6969
it("replaces the progress as the legend of the circle", () => {
7070
const legendValue = 324;
7171
wrapper.setProps({ legendValue });
72-
expect(wrapper.vm.legendVal).to.equal(legendValue);
72+
expect(wrapper.vm.computedLegend).to.equal(legendValue);
7373
expect(wrapper.vm.progress).to.equal(progress);
7474
});
7575
});

0 commit comments

Comments
 (0)