1
1
import { WordCloud } from '../../../../src' ;
2
2
import { CountryEconomy } from '../../../data/country-economy' ;
3
3
import { createDiv } from '../../../utils/dom' ;
4
+ import { delay } from '../../../utils/delay' ;
4
5
5
6
describe ( 'word-cloud changeData' , ( ) => {
6
- it ( 'changeData: normal' , ( ) => {
7
+ it ( 'changeData: normal' , async ( ) => {
7
8
const cloud = new WordCloud ( createDiv ( ) , {
8
9
width : 1024 ,
9
10
height : 1024 ,
@@ -18,6 +19,8 @@ describe('word-cloud changeData', () => {
18
19
19
20
cloud . render ( ) ;
20
21
22
+ await delay ( cloud . options . timeInterval || 10 ) ;
23
+
21
24
expect ( cloud . chart . geometries [ 0 ] . elements . length ) . toEqual ( CountryEconomy . length + 2 ) ;
22
25
23
26
const newData = CountryEconomy . slice ( 0 , 20 ) ;
@@ -28,7 +31,7 @@ describe('word-cloud changeData', () => {
28
31
cloud . destroy ( ) ;
29
32
} ) ;
30
33
31
- it ( 'changeData: from empty to have data' , ( ) => {
34
+ it ( 'changeData: from empty to have data' , async ( ) => {
32
35
const cloud = new WordCloud ( createDiv ( ) , {
33
36
width : 1024 ,
34
37
height : 1024 ,
@@ -44,6 +47,9 @@ describe('word-cloud changeData', () => {
44
47
cloud . render ( ) ;
45
48
46
49
cloud . changeData ( CountryEconomy ) ;
50
+
51
+ await delay ( cloud . options . timeInterval || 10 ) ;
52
+
47
53
expect ( cloud . chart . geometries [ 0 ] . elements . length ) . toEqual ( CountryEconomy . length + 2 ) ;
48
54
expect ( cloud . options . data ) . toEqual ( CountryEconomy ) ;
49
55
0 commit comments