-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathplotly.js
39 lines (35 loc) · 850 Bytes
/
plotly.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
import EventEmitter from 'event-emitter';
const state = {};
const ASYNC_DELAY = 1;
export default {
newPlot: jest.fn((gd) => {
state.gd = gd;
EventEmitter(state.gd); // eslint-disable-line new-cap
setTimeout(() => {
state.gd.emit('plotly_afterplot');
}, ASYNC_DELAY);
}),
react: jest.fn((gd) => {
state.gd = gd;
EventEmitter(state.gd); // eslint-disable-line new-cap
setTimeout(() => {
state.gd.emit('plotly_afterplot');
}, ASYNC_DELAY);
}),
relayout: jest.fn((gd) => {
state.gd = gd;
setTimeout(() => {
state.gd.emit('plotly_relayout');
}, ASYNC_DELAY);
}),
restyle: jest.fn((gd) => {
state.gd = gd;
setTimeout(() => {
state.gd.emit('plotly_restyle');
}, ASYNC_DELAY);
}),
update: jest.fn(),
purge: jest.fn(() => {
state.gd = null;
}),
};