@@ -125,7 +125,7 @@ describe('饼图 异常数据', () => {
125
125
} ) ;
126
126
127
127
describe ( '数据存在 NaN' , ( ) => {
128
- const createPie = ( data ) => {
128
+ const createPie = ( data ) : Pie => {
129
129
const pie = new Pie ( createDiv ( ) , {
130
130
angleField : 'value' ,
131
131
colorField : 'type' ,
@@ -143,6 +143,8 @@ describe('数据存在 NaN', () => {
143
143
] ) ;
144
144
expect ( pie . chart ) . toBeDefined ( ) ;
145
145
expect ( pie . chart . getData ( ) ) . toEqual ( [ { type : '2' , value : 10 } ] ) ;
146
+
147
+ pie . destroy ( ) ;
146
148
} ) ;
147
149
148
150
it ( '从正常数据 change 到存在 NaN' , ( ) => {
@@ -151,6 +153,7 @@ describe('数据存在 NaN', () => {
151
153
expect ( pie . chart ) . toBeDefined ( ) ;
152
154
expect ( pie . options . data ) . toEqual ( [ { type : '1' , value : NaN } ] ) ;
153
155
expect ( pie . chart . getData ( ) ) . toEqual ( [ ] ) ;
156
+ pie . destroy ( ) ;
154
157
} ) ;
155
158
156
159
it ( '从 [] change 到存在 NaN' , ( ) => {
@@ -159,6 +162,7 @@ describe('数据存在 NaN', () => {
159
162
expect ( pie . chart ) . toBeDefined ( ) ;
160
163
expect ( pie . options . data ) . toEqual ( [ { type : '1' , value : NaN } ] ) ;
161
164
expect ( pie . chart . getData ( ) ) . toEqual ( [ ] ) ;
165
+ pie . destroy ( ) ;
162
166
} ) ;
163
167
164
168
it ( '从存在数据 0 change 到存在 NaN' , ( ) => {
@@ -178,11 +182,12 @@ describe('数据存在 NaN', () => {
178
182
] ) ;
179
183
expect ( pie . chart . getData ( ) [ 0 ] ) . toMatchObject ( { type : '2' , value : 0 } ) ;
180
184
expect ( pie . chart . geometries [ 0 ] . elements . length ) . toEqual ( 1 ) ;
185
+ pie . destroy ( ) ;
181
186
} ) ;
182
187
} ) ;
183
188
184
189
describe ( '环图 changeData' , ( ) => {
185
- const createDonut = ( data ) => {
190
+ const createDonut = ( data ) : Pie => {
186
191
const donut = new Pie ( createDiv ( ) , {
187
192
angleField : 'value' ,
188
193
colorField : 'type' ,
@@ -204,6 +209,8 @@ describe('环图 changeData', () => {
204
209
{ type : '2' , value : 3 } ,
205
210
] ) ;
206
211
expect ( donut . chart . getController ( 'annotation' ) . getComponents ( ) . length ) . toBe ( 3 ) ;
212
+
213
+ donut . destroy ( ) ;
207
214
} ) ;
208
215
209
216
it ( '从数据全 0 到正常' , ( ) => {
@@ -218,5 +225,7 @@ describe('环图 changeData', () => {
218
225
{ type : '2' , value : 3 } ,
219
226
] ) ;
220
227
expect ( donut . chart . getController ( 'annotation' ) . getComponents ( ) . length ) . toBe ( 3 ) ;
228
+
229
+ donut . destroy ( ) ;
221
230
} ) ;
222
231
} ) ;
0 commit comments