@@ -2,19 +2,23 @@ import { expect } from "chai";
2
2
import CircleContainer from "@/components/Circle/CircleContainer.vue" ;
3
3
import Circle from "@/components/Circle/Circle.vue" ;
4
4
import CircleDot from "@/components/Circle/CircleDot.vue" ;
5
- import { animationParser , dotParser } from "@/components/optionsParser" ;
6
- import { factory } from "@/../tests/helper" ;
5
+ import { dotParser } from "@/components/optionsParser" ;
6
+ import { factory , parseRawOptions } from "@/../tests/helper" ;
7
7
8
- const localFactory = ( props = { } , container = Circle ) => factory ( { container, props } ) ;
8
+ const localFactory = ( props = { } , container = CircleContainer ) => factory ( { container, props : parseRawOptions ( props ) } ) ;
9
9
10
10
describe ( "#dot" , ( ) => {
11
11
const progress = 50 ;
12
12
const thickness = 5 ;
13
13
const size = 500 ;
14
14
const globalDot = "5%" ;
15
15
16
+ it ( "does not renders dot component with 0 size" , ( ) => {
17
+ expect ( localFactory ( ) . findComponent ( CircleDot ) . exists ( ) ) . to . be . false ;
18
+ } ) ;
19
+
16
20
it ( "applies default dot value correctly" , ( ) => {
17
- const wrapper = localFactory ( { } , CircleContainer ) ;
21
+ const wrapper = localFactory ( { } ) ;
18
22
const dotSpanWrapper = wrapper . find ( ".ep-circle--progress__dot" ) ;
19
23
20
24
expect ( dotSpanWrapper . element . style . width ) . to . equal ( "0px" ) ;
@@ -23,10 +27,7 @@ describe("#dot", () => {
23
27
} ) ;
24
28
25
29
it ( `calculates and applies correct rotation of the dot container depending on progress` , ( done ) => {
26
- const wrapper = localFactory (
27
- { progress, dot : dotParser ( 5 , size ) , animation : animationParser ( "default 0 0" ) } ,
28
- CircleContainer
29
- ) ;
30
+ const wrapper = localFactory ( { progress, dot : 5 , animation : "default 0 0" } ) ;
30
31
const circleDotWrapper = wrapper . findComponent ( CircleDot ) ;
31
32
const rotationStart = wrapper . props ( "options" ) . angle + 90 ;
32
33
const rotation = rotationStart + ( progress * 360 ) / 100 ;
@@ -37,10 +38,7 @@ describe("#dot", () => {
37
38
} ) ;
38
39
39
40
it ( `applies correct initial rotation of the dot container` , async ( ) => {
40
- const wrapper = localFactory (
41
- { progress, dot : dotParser ( 5 , size ) , animation : animationParser ( "default 0 1000" ) } ,
42
- CircleContainer
43
- ) ;
41
+ const wrapper = localFactory ( { progress, dot : 5 , animation : "default 0 1000" } ) ;
44
42
const circleDotWrapper = wrapper . findComponent ( CircleDot ) ;
45
43
const angle = wrapper . props ( "options" ) . angle ;
46
44
const rotationStart = angle + 90 ;
@@ -55,8 +53,8 @@ describe("#dot", () => {
55
53
const wrapper = localFactory (
56
54
{
57
55
progress,
58
- dot : dotParser ( { size : 10 , background : "red" , border : "2px solid green" } , size ) ,
59
- animation : animationParser ( "default 0 1000" ) ,
56
+ dot : { size : 10 , background : "red" , border : "2px solid green" } ,
57
+ animation : "default 0 1000" ,
60
58
} ,
61
59
CircleDot
62
60
) . find ( "span.ep-circle--progress__dot" ) ;
@@ -66,7 +64,7 @@ describe("#dot", () => {
66
64
67
65
it ( `do not apply custom height to dot` , async ( ) => {
68
66
const wrapper = localFactory (
69
- { progress, dot : dotParser ( { size : 10 , height : "20px" } , size ) , animation : animationParser ( "default 0 1000" ) } ,
67
+ { progress, dot : { size : 10 , height : "20px" } , animation : "default 0 1000" } ,
70
68
CircleDot
71
69
) . find ( "span.ep-circle--progress__dot" ) ;
72
70
expect ( wrapper . element . style . height ) . to . equal ( "10px" ) ;
@@ -86,7 +84,7 @@ describe("#dot", () => {
86
84
87
85
for ( let i = 0 ; i < data . length ; i ++ ) {
88
86
const circleData = data [ i ] ;
89
- const wrapper = localFactory ( { ...circleData , size, dot : dotParser ( circleData . dot , size ) } , CircleContainer ) ;
87
+ const wrapper = localFactory ( { ...circleData , size, dot : circleData . dot } ) ;
90
88
const circleDotSpanWrapper = wrapper . find ( "span.ep-circle--progress__dot" ) ;
91
89
const circleDotWrapper = wrapper . findComponent ( CircleDot ) ;
92
90
const circleWrapper = wrapper . findComponent ( Circle ) ;
0 commit comments