@@ -5,7 +5,8 @@ import CircleContainer from "@/components/Circle/CircleContainer.vue";
5
5
import Counter from "@/components/Counter.vue" ;
6
6
import { animationParser , dotParser , dashParser , lineModeParser , linePositionParser } from "@/components/optionsParser" ;
7
7
import props from "@/components/interface" ;
8
- import { defaultCounterTick } from "@/../tests/helper" ;
8
+ import { defaultCounterTick , wait } from "@/../tests/helper" ;
9
+ import { nextTick } from "vue" ;
9
10
10
11
const factory = ( propsData , slots = { } ) => {
11
12
return mount ( VueEllipseProgress , {
@@ -74,6 +75,25 @@ describe("[ EllipseProgressContainer.vue ]", () => {
74
75
expect ( wrapper . vm . progress ) . to . equal ( progress ) ;
75
76
} ) ;
76
77
} ) ;
78
+ describe ( "#hideLegend" , ( ) => {
79
+ const wrapper = factory ( { hideLegend : true } ) ;
80
+ const legendWrapper = wrapper . find ( ".ep-legend--value" ) ;
81
+
82
+ it ( "adds hide class to the legend element" , async ( ) => {
83
+ expect ( legendWrapper . classes ( ) ) . to . be . an ( "array" ) . that . include ( "ep-hidden" ) ;
84
+ } ) ;
85
+
86
+ it ( "applies height to the style attribute" , ( ) => {
87
+ // anything we can test about it as jsdom does not render actual layout
88
+ expect ( legendWrapper . element . style ) . to . be . an ( "object" ) . that . have . property ( "height" ) ;
89
+ } ) ;
90
+
91
+ it ( "removes the hide class from the legend element, if false" , async ( ) => {
92
+ await wrapper . setProps ( { hideLegend : false } ) ;
93
+ await nextTick ( ) ;
94
+ expect ( legendWrapper . classes ( ) ) . to . be . an ( "array" ) . that . not . include ( "ep-hidden" ) ;
95
+ } ) ;
96
+ } ) ;
77
97
describe ( "#noData" , ( ) => {
78
98
const wrapper = factory ( { noData : true } ) ;
79
99
it ( "hides the legend, if true" , ( ) => {
0 commit comments