|
1 | 1 | // eslint-disable-next-line max-classes-per-file |
2 | | -import { getContainer, sleep } from 'tests/util/helpers'; |
| 2 | +import { getContainer } from 'tests/util/helpers'; |
3 | 3 | import * as dataCfg from 'tests/data/simple-data.json'; |
4 | 4 | import { Canvas, Event as GEvent } from '@antv/g-canvas'; |
5 | 5 | import { cloneDeep } from 'lodash'; |
@@ -181,6 +181,8 @@ describe('PivotSheet Tests', () => { |
181 | 181 | sheet.showTooltipWithInfo({ clientX: 0, clientY: 0 } as MouseEvent, []); |
182 | 182 |
|
183 | 183 | expect(sheet.tooltip.container.innerHTML).toEqual(tooltipContent); |
| 184 | + |
| 185 | + sheet.destroy(); |
184 | 186 | }); |
185 | 187 |
|
186 | 188 | test.each([ |
@@ -214,6 +216,8 @@ describe('PivotSheet Tests', () => { |
214 | 216 | sheet.showTooltipWithInfo({ clientX: 0, clientY: 0 } as MouseEvent, []); |
215 | 217 |
|
216 | 218 | expect(sheet.tooltip.container.innerHTML).toEqual(tooltipContent); |
| 219 | + |
| 220 | + sheet.destroy(); |
217 | 221 | }, |
218 | 222 | ); |
219 | 223 |
|
@@ -247,6 +251,8 @@ describe('PivotSheet Tests', () => { |
247 | 251 | }); |
248 | 252 |
|
249 | 253 | expect(sheet.tooltip.container.innerHTML).toEqual(methodTooltipContent); |
| 254 | + |
| 255 | + sheet.destroy(); |
250 | 256 | }, |
251 | 257 | ); |
252 | 258 |
|
@@ -279,6 +285,8 @@ describe('PivotSheet Tests', () => { |
279 | 285 | expect( |
280 | 286 | sheet.tooltip.container.contains(defaultTooltipContent), |
281 | 287 | ).toBeFalsy(); |
| 288 | + |
| 289 | + sheet.destroy(); |
282 | 290 | }, |
283 | 291 | ); |
284 | 292 |
|
@@ -314,6 +322,8 @@ describe('PivotSheet Tests', () => { |
314 | 322 | expect( |
315 | 323 | sheet.tooltip.container.contains(methodTooltipContent), |
316 | 324 | ).toBeTruthy(); |
| 325 | + |
| 326 | + sheet.destroy(); |
317 | 327 | }, |
318 | 328 | ); |
319 | 329 |
|
@@ -361,6 +371,8 @@ describe('PivotSheet Tests', () => { |
361 | 371 | expect(customShow).toHaveBeenCalled(); |
362 | 372 | expect(customHide).toHaveBeenCalled(); |
363 | 373 | expect(customDestroy).toHaveBeenCalled(); |
| 374 | + |
| 375 | + sheet.destroy(); |
364 | 376 | }); |
365 | 377 |
|
366 | 378 | test('should show invalid custom tooltip warning', () => { |
@@ -388,6 +400,8 @@ describe('PivotSheet Tests', () => { |
388 | 400 | sheet.tooltip as unknown |
389 | 401 | )?.constructor?.toString()} should be extends from BaseTooltip`, |
390 | 402 | ); |
| 403 | + |
| 404 | + sheet.destroy(); |
391 | 405 | }); |
392 | 406 | }); |
393 | 407 |
|
@@ -741,11 +755,11 @@ describe('PivotSheet Tests', () => { |
741 | 755 | test('should destroy sheet', () => { |
742 | 756 | const facetDestroySpy = jest |
743 | 757 | .spyOn(s2.facet, 'destroy') |
744 | | - .mockImplementation(() => {}); |
| 758 | + .mockImplementationOnce(() => {}); |
745 | 759 |
|
746 | 760 | const hdAdapterDestroySpy = jest |
747 | 761 | .spyOn(s2.hdAdapter, 'destroy') |
748 | | - .mockImplementation(() => {}); |
| 762 | + .mockImplementationOnce(() => {}); |
749 | 763 |
|
750 | 764 | s2.render(false); |
751 | 765 |
|
|
0 commit comments