-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
animate-spec.js
59 lines (50 loc) 路 1.68 KB
/
animate-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const expect = require('chai').expect;
const Animate = require('../../../src/animate/animate');
const Coord = require('@antv/coord/lib/index');
const Action = require('../../../src/animate/action');
describe('Animate', () => {
it('Animate.getAnimateCfg', () => {
let geomType = 'line';
let animationType = 'appear';
let result = Animate.getAnimateCfg(geomType, animationType);
expect(result).eq(Animate.defaultCfg[animationType]);
geomType = 'area';
animationType = 'update';
result = Animate.getAnimateCfg(geomType, animationType);
expect(result).to.deep.equal(Animate.area.cfg[animationType]);
geomType = 'label';
animationType = 'update';
result = Animate.getAnimateCfg(geomType, animationType);
expect(result).eq(Animate.defaultCfg[animationType]);
});
it('Animate.getAnimation', () => {
const coord = new Coord.Cartesian({
start: {
x: 0,
y: 300
},
end: {
x: 200,
y: 0
}
});
let geomType = 'heatmap';
let animationType = 'appear';
let result = Animate.getAnimation(geomType, coord, animationType);
expect(result).to.equal(false);
geomType = 'axis-ticks';
animationType = 'update';
result = Animate.getAnimation(geomType, coord, animationType);
expect(result).to.be.undefined;
geomType = 'line';
animationType = 'leave';
result = Animate.getAnimation(geomType, coord, animationType);
expect(result).not.to.be.undefined;
});
it('Animate.registerAnimation', () => {
Animate.registerAnimation('leave', 'myAnimation', function() {
return 'success';
});
expect(Action.leave.myAnimation).to.be.an.instanceof(Function);
});
});