1
1
import { expect } from "chai" ;
2
2
import Circle from "@/components/Circle/Circle.vue" ;
3
3
import { factory } from "@/../tests/helper" ;
4
+ import { calcThickness } from "@/components/optionsParser" ;
4
5
5
6
const localFactory = ( props ) => factory ( { container : Circle , props } ) ;
6
7
@@ -15,14 +16,10 @@ describe("#thickness", () => {
15
16
} ) ;
16
17
it ( "renders and calculates the progress circle line stroke relative thickness correctly" , ( ) => {
17
18
const size = 200 ;
18
- const thickness = "5%" ;
19
- const relativeThickness = ( parseInt ( thickness , 10 ) * size ) / 100 ;
19
+ const thickness = calcThickness ( "5%" , size ) ;
20
20
21
- const wrapper = localFactory ( { thickness } ) ;
22
- const circleProgressWrapper = wrapper . find ( "circle.ep-circle--progress" ) ;
23
-
24
- expect ( wrapper . vm . computedThickness ) . to . equal ( relativeThickness ) ;
25
- expect ( circleProgressWrapper . element . getAttribute ( "stroke-width" ) ) . to . equal ( `${ relativeThickness } ` ) ;
21
+ const circleProgressWrapper = localFactory ( { thickness } ) . find ( "circle.ep-circle--progress" ) ;
22
+ expect ( circleProgressWrapper . element . getAttribute ( "stroke-width" ) ) . to . equal ( `${ thickness } ` ) ;
26
23
} ) ;
27
24
} ) ;
28
25
describe ( "#emptyTthickness" , ( ) => {
@@ -34,15 +31,11 @@ describe("#emptyTthickness", () => {
34
31
35
32
expect ( circleEmptyWrapper . element . getAttribute ( "stroke-width" ) ) . to . equal ( `${ emptyThickness } ` ) ;
36
33
} ) ;
37
- it ( "renders and calculates the empty circle line stroke relative thickness correctly" , ( ) => {
34
+ it ( "renders the empty circle line stroke relative thickness correctly" , ( ) => {
38
35
const size = 200 ;
39
- const emptyThickness = "5%" ;
40
- const relativeThickness = ( parseInt ( emptyThickness , 10 ) * size ) / 100 ;
36
+ const emptyThickness = calcThickness ( "5%" , size ) ;
41
37
42
- const wrapper = localFactory ( { emptyThickness } ) ;
43
- const circleEmptyWrapper = wrapper . find ( "circle.ep-circle--empty" ) ;
44
-
45
- expect ( wrapper . vm . computedEmptyThickness ) . to . equal ( relativeThickness ) ;
46
- expect ( circleEmptyWrapper . element . getAttribute ( "stroke-width" ) ) . to . equal ( `${ relativeThickness } ` ) ;
38
+ const circleEmptyWrapper = localFactory ( { emptyThickness } ) . find ( "circle.ep-circle--empty" ) ;
39
+ expect ( circleEmptyWrapper . element . getAttribute ( "stroke-width" ) ) . to . equal ( `${ emptyThickness } ` ) ;
47
40
} ) ;
48
41
} ) ;
0 commit comments