diff --git a/__tests__/unit/core/index-spec.ts b/__tests__/unit/core/index-spec.ts index 834421a99a1..e06be29aa7a 100644 --- a/__tests__/unit/core/index-spec.ts +++ b/__tests__/unit/core/index-spec.ts @@ -201,7 +201,7 @@ describe('core', () => { expect(line.triggerResize).toHaveBeenCalledTimes(0); container.style.width = `${container.clientWidth + 10}px`; - await delay(200); + await delay(500); // @ts-ignore expect(line.triggerResize).toHaveBeenCalledTimes(1); diff --git a/__tests__/unit/plots/word-cloud/change-data-spec.ts b/__tests__/unit/plots/word-cloud/change-data-spec.ts index 5393648a8ef..436e51601b1 100644 --- a/__tests__/unit/plots/word-cloud/change-data-spec.ts +++ b/__tests__/unit/plots/word-cloud/change-data-spec.ts @@ -1,41 +1,47 @@ import { WordCloud } from '../../../../src'; import { CountryEconomy } from '../../../data/country-economy'; +import { delay } from '../../../utils/delay'; import { createDiv } from '../../../utils/dom'; describe('word-cloud changeData', () => { - it('changeData: normal', () => { + it('changeData: normal', async () => { const cloud = new WordCloud(createDiv(), { width: 1024, height: 1024, data: CountryEconomy, wordField: 'Country', weightField: 'GDP', + animation: false, }); cloud.render(); + await delay(500); expect(cloud.chart.geometries[0].elements.length).toEqual(CountryEconomy.length + 2); const newData = CountryEconomy.slice(0, 20); cloud.changeData(newData); + await delay(500); expect(cloud.chart.geometries[0].elements.length).toEqual(newData.length + 2); expect(cloud.options.data).toEqual(newData); cloud.destroy(); }); - it('changeData: from empty to have data', () => { + it('changeData: from empty to have data', async () => { const cloud = new WordCloud(createDiv(), { width: 1024, height: 1024, data: [], wordField: 'Country', weightField: 'GDP', + animation: false, }); cloud.render(); cloud.changeData(CountryEconomy); + await delay(500); expect(cloud.chart.geometries[0].elements.length).toEqual(CountryEconomy.length + 2); expect(cloud.options.data).toEqual(CountryEconomy);