@@ -44,6 +44,41 @@ describe('<VueUiDonut />', () => {
44
44
} )
45
45
}
46
46
47
+ function testEmits ( wrapper ) {
48
+ cy . log ( '@selectLegend' ) ;
49
+ cy . get ( '[data-cy="legend-item"]' ) . first ( ) . click ( { force : true } ) . then ( ( ) => {
50
+ expect ( wrapper . emitted ( 'selectLegend' ) ) . to . exist ;
51
+ } ) ;
52
+
53
+ cy . log ( 'selectDatapoint' ) ;
54
+ cy . get ( '[data-cy="tooltip-trap"]' ) . first ( ) . click ( { force : true } ) . then ( ( ) => {
55
+ expect ( wrapper . emitted ( 'selectDatapoint' ) [ 0 ] [ 0 ] ) . to . have . keys ( 'datapoint' , 'index' ) ;
56
+ expect ( wrapper . emitted ( 'selectDatapoint' ) [ 0 ] [ 0 ] . index ) . to . equal ( 0 ) ;
57
+ expect ( wrapper . emitted ( 'selectDatapoint' ) [ 0 ] [ 0 ] . datapoint ) . to . have . keys (
58
+ 'absoluteValues' ,
59
+ 'arcSlice' ,
60
+ 'center' ,
61
+ 'color' ,
62
+ 'comment' ,
63
+ 'cx' ,
64
+ 'cy' ,
65
+ 'endX' ,
66
+ 'endY' ,
67
+ 'firstSeparator' ,
68
+ 'name' ,
69
+ 'path' ,
70
+ 'patternIndex' ,
71
+ 'proportion' ,
72
+ 'ratio' ,
73
+ 'separator' ,
74
+ 'seriesIndex' ,
75
+ 'startX' ,
76
+ 'startY' ,
77
+ 'value'
78
+ ) ;
79
+ } ) ;
80
+ }
81
+
47
82
it ( 'renders donut default variation' , ( ) => {
48
83
cy . mount ( VueUiDonut , {
49
84
props : {
@@ -55,7 +90,7 @@ describe('<VueUiDonut />', () => {
55
90
'data-cy' : 'slot-plot-comment'
56
91
} , plot . comment )
57
92
}
58
- } ) . then ( ( ) => {
93
+ } ) . then ( ( { wrapper } ) => {
59
94
commonTest ( ) ;
60
95
61
96
cy . get ( '[data-cy="donut-arc"]' ) . should ( 'exist' ) . and ( 'be.visible' ) . and ( 'have.length' , dataset . length ) ;
@@ -68,6 +103,7 @@ describe('<VueUiDonut />', () => {
68
103
cy . get ( '[data-cy="hollow-average-value"]' ) . should ( 'exist' ) . and ( 'be.visible' ) . contains ( average . toFixed ( 0 ) ) ;
69
104
70
105
testDataLabels ( 'donut' ) ;
106
+ testEmits ( wrapper ) ;
71
107
} ) ;
72
108
} ) ;
73
109
@@ -85,13 +121,14 @@ describe('<VueUiDonut />', () => {
85
121
'data-cy' : 'slot-plot-comment'
86
122
} , plot . comment )
87
123
}
88
- } ) . then ( ( ) => {
124
+ } ) . then ( ( { wrapper } ) => {
89
125
commonTest ( ) ;
90
126
91
127
cy . get ( '[data-cy="polar-datapoint"]' ) . should ( 'exist' ) . and ( 'be.visible' ) . and ( 'have.length' , dataset . length ) ;
92
128
cy . get ( '[data-cy="polar-shadow"]' ) . should ( 'exist' ) . and ( 'be.visible' ) . and ( 'have.length' , dataset . length ) ;
93
129
94
130
testDataLabels ( 'polar' ) ;
131
+ testEmits ( wrapper ) ;
95
132
} ) ;
96
133
} ) ;
97
134
} ) ;
0 commit comments