forked from chartjs/Chart.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.animator.tests.js
48 lines (47 loc) · 1.14 KB
/
core.animator.tests.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
describe('Chart.animator', function() {
it('should fire onProgress for each draw', function(done) {
let count = 0;
let drawCount = 0;
const progress = (animation) => {
count++;
expect(animation.numSteps).toEqual(250);
expect(animation.currentStep <= 250).toBeTrue();
};
acquireChart({
type: 'bar',
data: {
datasets: [
{data: [10, 5, 0, 25, 78, -10]}
],
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', 'tick6']
},
options: {
animation: {
duration: 250,
onProgress: progress,
onComplete: function() {
expect(count).toEqual(drawCount);
done();
}
}
},
plugins: [{
afterDraw() {
drawCount++;
}
}]
}, {
canvas: {
height: 150,
width: 250
},
});
});
it('should not fail when adding no items', function() {
const chart = {};
Chart.animator.add(chart, undefined);
Chart.animator.add(chart, []);
Chart.animator.start(chart);
expect(Chart.animator.running(chart)).toBeFalse();
});
});