Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0d5e77

Browse files
committedMar 9, 2017
revamp gl2d click test suite
- rm `noCI` tag - add abstractions to test hover/click/unhover for every gl2d trace type - merge redundant specs
1 parent e52f020 commit c0d5e77

File tree

1 file changed

+238
-539
lines changed

1 file changed

+238
-539
lines changed
 

‎test/jasmine/tests/gl2d_click_test.js

Lines changed: 238 additions & 539 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var Lib = require('@src/lib');
44
var createGraphDiv = require('../assets/create_graph_div');
55
var destroyGraphDiv = require('../assets/destroy_graph_div');
66
var customMatchers = require('../assets/custom_matchers');
7+
var fail = require('../assets/fail_test.js');
78

89
// cartesian click events events use the hover data
910
// from the mousemove events and then simulate
@@ -16,585 +17,283 @@ Plotly.register([
1617
require('@lib/contourgl')
1718
]);
1819

19-
describe('@noCI Test hover and click interactions', function() {
20-
21-
var mock = require('@mocks/gl2d_14.json');
22-
var mock2 = require('@mocks/gl2d_pointcloud-basic.json');
23-
var mock3 = {
24-
'data': [
25-
{
26-
'type': 'contourgl',
27-
'z': [
28-
[
29-
10,
30-
10.625,
31-
12.5,
32-
15.625,
33-
20
34-
],
35-
[
36-
5.625,
37-
6.25,
38-
8.125,
39-
11.25,
40-
15.625
41-
],
42-
[
43-
2.5,
44-
3.125,
45-
5,
46-
8.125,
47-
12.5
48-
],
49-
[
50-
0.625,
51-
1.25,
52-
3.125,
53-
6.25,
54-
10.625
55-
],
56-
[
57-
0,
58-
0.625,
59-
2.5,
60-
5.625,
61-
10
62-
]
63-
],
64-
'colorscale': 'Jet',
65-
/* 'contours': {
66-
'start': 2,
67-
'end': 10,
68-
'size': 1
69-
},*/
70-
'uid': 'ad5624',
71-
'zmin': 0,
72-
'zmax': 20
73-
}
20+
var mock1 = require('@mocks/gl2d_14.json');
21+
var mock2 = require('@mocks/gl2d_pointcloud-basic.json');
22+
23+
var mock3 = {
24+
data: [{
25+
type: 'contourgl',
26+
z: [
27+
[10, 10.625, 12.5, 15.625, 20],
28+
[5.625, 6.25, 8.125, 11.25, 15.625],
29+
[2.5, 3.125, 5, 8.125, 12.5],
30+
[0.625, 1.25, 3.125, 6.25, 10.625],
31+
[0, 0.625, 2.5, 5.625, 10]
7432
],
75-
'layout': {
76-
'xaxis': {
77-
'range': [
78-
0,
79-
4
80-
],
81-
'autorange': true
82-
},
83-
'yaxis': {
84-
'range': [
85-
0,
86-
4
87-
],
88-
'autorange': true
89-
},
90-
'height': 450,
91-
'width': 1000,
92-
'autosize': true
93-
}
94-
};
95-
var mock4 = {
96-
data: [
97-
{
98-
x: [1, 2, 3, 4],
99-
y: [12, 3, 14, 4],
100-
type: 'scattergl',
101-
mode: 'markers'
102-
},
103-
{
104-
x: [4, 5, 6, 7],
105-
y: [1, 31, 24, 14],
106-
type: 'scattergl',
107-
mode: 'markers'
108-
},
109-
{
110-
x: [8, 9, 10, 11],
111-
y: [18, 13, 10, 3],
112-
type: 'scattergl',
113-
mode: 'markers'
114-
}],
115-
layout: {}
116-
};
117-
118-
var mockCopy, gd;
119-
120-
function check(pt) {
121-
expect(Object.keys(pt)).toEqual([
122-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
123-
]);
124-
125-
expect(pt.x).toEqual(15.772);
126-
expect(pt.y).toEqual(0.387);
127-
expect(pt.curveNumber).toEqual(0);
128-
expect(pt.pointNumber).toEqual(33);
129-
expect(pt.fullData.length).toEqual(1);
130-
expect(typeof pt.data.uid).toEqual('string');
131-
expect(pt.xaxis.domain.length).toEqual(2);
132-
expect(pt.yaxis.domain.length).toEqual(2);
133-
}
134-
135-
beforeAll(function() {
136-
jasmine.addMatchers(customMatchers);
137-
});
138-
139-
beforeEach(function() {
140-
gd = createGraphDiv();
141-
mockCopy = Lib.extendDeep({}, mock);
142-
});
143-
144-
afterEach(destroyGraphDiv);
145-
146-
describe('hover event is fired on hover', function() {
147-
var futureData;
148-
149-
it('in general', function(done) {
150-
151-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
152-
153-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
154-
155-
.then(new Promise(function() {
156-
157-
gd.on('plotly_hover', function(data) {
158-
futureData = data;
159-
});
160-
161-
hover(654.7712871743302, 316.97670766680994);
162-
163-
window.setTimeout(function() {
164-
165-
expect(futureData.points.length).toEqual(1);
166-
167-
var pt = futureData.points[0];
168-
169-
check(pt);
170-
171-
done();
172-
}, 250);
173-
}));
174-
175-
33+
colorscale: 'Jet',
34+
// contours: { start: 2, end: 10, size: 1 },
35+
zmin: 0,
36+
zmax: 20
37+
}],
38+
layout: {}
39+
};
40+
41+
var mock4 = {
42+
data: [{
43+
x: [1, 2, 3, 4],
44+
y: [12, 3, 14, 4],
45+
type: 'scattergl',
46+
mode: 'markers'
47+
}, {
48+
x: [4, 5, 6, 7],
49+
y: [1, 31, 24, 14],
50+
type: 'scattergl',
51+
mode: 'markers'
52+
}, {
53+
x: [8, 9, 10, 11],
54+
y: [18, 13, 10, 3],
55+
type: 'scattergl',
56+
mode: 'markers'
57+
}],
58+
layout: {}
59+
};
60+
61+
describe('Test hover and click interactions', function() {
62+
var gd;
63+
64+
// need to wait a little bit before canvas can properly catch mouse events
65+
function wait() {
66+
return new Promise(function(resolve) {
67+
setTimeout(resolve, 100);
17668
});
69+
}
17770

178-
it('even when hoverinfo (== plotly tooltip) is set to none', function(done) {
179-
180-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
181-
modifiedMockCopy.data[0].hoverinfo = 'none';
182-
183-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
184-
185-
.then(new Promise(function() {
186-
187-
gd.on('plotly_hover', function(data) {
188-
futureData = data;
189-
});
190-
191-
hover(654.7712871743302, 316.97670766680994);
192-
193-
window.setTimeout(function() {
194-
195-
expect(futureData.points.length).toEqual(1);
196-
197-
var pt = futureData.points[0];
198-
199-
check(pt);
200-
201-
done();
202-
}, 250);
203-
}));
204-
205-
206-
});
207-
208-
it('event happens even on a click interaction', function(done) {
209-
210-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
211-
modifiedMockCopy.data[0].hoverinfo = 'none';
212-
213-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
214-
215-
.then(new Promise(function() {
216-
217-
gd.on('plotly_hover', function(data) {
218-
futureData = data;
219-
});
220-
221-
click(654.7712871743302, 316.97670766680994);
222-
223-
window.setTimeout(function() {
224-
225-
expect(futureData.points.length).toEqual(1);
226-
227-
var pt = futureData.points[0];
228-
229-
check(pt);
230-
231-
done();
232-
}, 250);
233-
}));
234-
235-
236-
});
237-
238-
it('unhover happens', function(done) {
239-
240-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
241-
modifiedMockCopy.data[0].hoverinfo = 'none';
242-
243-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
244-
245-
.then(new Promise(function() {
246-
247-
futureData = undefined;
248-
249-
gd.on('plotly_unhover', function() {
250-
futureData = 'emitted plotly_unhover';
251-
});
252-
253-
hover(654.7712871743302, 316.97670766680994);
254-
255-
// fairly realistic simulation of moving with the cursor
256-
window.setTimeout(function() {
257-
258-
var x = 654, y = 316; // we start here
259-
var canceler = window.setInterval(function() {
260-
hover(x--, y++); // move the cursor
261-
}, 10);
71+
function makeHoverFn(gd, x, y) {
72+
return function() {
73+
return new Promise(function(resolve) {
74+
gd.on('plotly_hover', resolve);
75+
hover(x, y);
76+
});
77+
};
78+
}
26279

263-
window.setTimeout(function() {
264-
window.clearInterval(canceler); // stop the mouse at some point
265-
}, 250);
80+
function makeClickFn(gd, x, y) {
81+
return function() {
82+
return new Promise(function(resolve) {
83+
gd.on('plotly_click', resolve);
84+
click(x, y);
85+
});
86+
};
87+
}
26688

267-
window.setTimeout(function() {
89+
function makeUnhoverFn(gd, x0, y0) {
90+
return function() {
91+
return new Promise(function(resolve) {
92+
var eventData = null;
26893

269-
expect(futureData).toEqual('emitted plotly_unhover');
94+
gd.on('plotly_unhover', function() {
95+
eventData = 'emitted plotly_unhover';
96+
});
27097

271-
done();
98+
// fairly realistic simulation of moving with the cursor
99+
var canceler = setInterval(function() {
100+
hover(x0--, y0--);
101+
}, 10);
102+
103+
setTimeout(function() {
104+
clearInterval(canceler);
105+
resolve(eventData);
106+
}, 350);
107+
});
108+
};
109+
}
272110

273-
}, 250);
111+
function assertEventData(actual, expected) {
112+
expect(actual.points.length).toEqual(1, 'points length');
274113

275-
}, 250);
276-
}));
114+
var pt = actual.points[0];
277115

278-
});
116+
expect(Object.keys(pt)).toEqual([
117+
'x', 'y', 'curveNumber', 'pointNumber',
118+
'data', 'fullData', 'xaxis', 'yaxis'
119+
], 'event data keys');
120+
121+
expect(typeof pt.data.uid).toEqual('string', 'uid');
122+
expect(pt.xaxis.domain.length).toEqual(2, 'xaxis');
123+
expect(pt.yaxis.domain.length).toEqual(2, 'yaxis');
124+
125+
expect(pt.x).toEqual(expected.x, 'x');
126+
expect(pt.y).toEqual(expected.y, 'y');
127+
expect(pt.curveNumber).toEqual(expected.curveNumber, 'curve number');
128+
expect(pt.pointNumber).toEqual(expected.pointNumber, 'point number');
129+
}
279130

131+
// returns basic hover/click/unhover runner for one xy position
132+
function makeRunner(pos, expected, opts) {
133+
opts = opts || {};
134+
135+
var _hover = makeHoverFn(gd, pos[0], pos[1]);
136+
var _click = makeClickFn(gd, pos[0], pos[1]);
137+
138+
var _unhover = opts.noUnHover ?
139+
function() { return 'emitted plotly_unhover'; } :
140+
makeUnhoverFn(gd, pos[0], pos[1]);
141+
142+
return function() {
143+
return wait()
144+
.then(_hover)
145+
.then(function(eventData) {
146+
assertEventData(eventData, expected);
147+
})
148+
.then(_click)
149+
.then(function(eventData) {
150+
assertEventData(eventData, expected);
151+
})
152+
.then(_unhover)
153+
.then(function(eventData) {
154+
expect(eventData).toEqual('emitted plotly_unhover');
155+
});
156+
};
157+
}
280158

159+
beforeAll(function() {
160+
jasmine.addMatchers(customMatchers);
281161
});
282162

283-
describe('hover event is fired for other gl2d plot types', function() {
284-
var futureData;
285-
286-
it('pointcloud', function(done) {
287-
288-
var modifiedMockCopy = Lib.extendDeep({}, mock2);
289-
290-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
291-
292-
.then(new Promise(function() {
293-
294-
gd.on('plotly_hover', function(data) {
295-
futureData = data;
296-
});
297-
298-
hover(540, 150);
299-
300-
window.setTimeout(function() {
301-
302-
expect(futureData.points.length).toEqual(1);
303-
304-
var pt = futureData.points[0];
305-
306-
expect(Object.keys(pt)).toEqual([
307-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
308-
]);
309-
310-
expect(pt.x).toEqual(4.5);
311-
expect(pt.y).toEqual(9);
312-
expect(pt.curveNumber).toEqual(2);
313-
expect(pt.pointNumber).toEqual(1);
314-
expect(pt.fullData.length).toEqual(3);
315-
expect(typeof pt.data.uid).toEqual('string');
316-
expect(pt.xaxis.domain.length).toEqual(2);
317-
expect(pt.yaxis.domain.length).toEqual(2);
318-
319-
done();
320-
}, 350);
321-
}));
163+
beforeEach(function() {
164+
gd = createGraphDiv();
165+
});
322166

167+
afterEach(function() {
168+
Plotly.purge(gd);
169+
destroyGraphDiv();
170+
});
323171

172+
it('should output correct event data for scattergl', function(done) {
173+
var _mock = Lib.extendDeep({}, mock1);
174+
var run = makeRunner([655, 317], {
175+
x: 15.772,
176+
y: 0.387,
177+
curveNumber: 0,
178+
pointNumber: 33
324179
});
325180

326-
it('heatmapgl', function(done) {
327-
328-
var modifiedMockCopy = Lib.extendDeep({}, mock3);
329-
modifiedMockCopy.data[0].type = 'heatmapgl';
330-
331-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
332-
333-
.then(new Promise(function() {
334-
335-
gd.on('plotly_hover', function(data) {
336-
futureData = data;
337-
});
338-
339-
hover(540, 150);
340-
341-
window.setTimeout(function() {
342-
343-
expect(futureData.points.length).toEqual(1);
344-
345-
var pt = futureData.points[0];
346-
347-
expect(Object.keys(pt)).toEqual([
348-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
349-
]);
350-
351-
expect(pt.x).toEqual(2);
352-
expect(pt.y).toEqual(3);
353-
expect(pt.curveNumber).toEqual(0);
354-
expect(pt.pointNumber).toEqual([2, 3]);
355-
expect(pt.fullData.length).toEqual(1);
356-
expect(typeof pt.data.uid).toEqual('string');
357-
expect(pt.xaxis.domain.length).toEqual(2);
358-
expect(pt.yaxis.domain.length).toEqual(2);
359-
360-
done();
361-
}, 350);
362-
}));
181+
Plotly.plot(gd, _mock)
182+
.then(run)
183+
.catch(fail)
184+
.then(done);
185+
});
363186

187+
it('should output correct event data for scattergl with hoverinfo: \'none\'', function(done) {
188+
var _mock = Lib.extendDeep({}, mock1);
189+
_mock.data[0].hoverinfo = 'none';
364190

191+
var run = makeRunner([655, 317], {
192+
x: 15.772,
193+
y: 0.387,
194+
curveNumber: 0,
195+
pointNumber: 33
365196
});
366197

367-
it('scattergl', function(done) {
368-
369-
var modifiedMockCopy = Lib.extendDeep({}, mock4);
370-
371-
function _hover() {
372-
hover(435, 216);
198+
Plotly.plot(gd, _mock)
199+
.then(run)
200+
.catch(fail)
201+
.then(done);
202+
});
373203

374-
return new Promise(function(resolve) {
375-
setTimeout(resolve, 350);
376-
});
377-
}
204+
it('should output correct event data for pointcloud', function(done) {
205+
var _mock = Lib.extendDeep({}, mock2);
378206

379-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout).then(function() {
380-
gd.on('plotly_hover', function(data) {
381-
futureData = data;
382-
});
383-
})
384-
.then(_hover)
385-
.then(function() {
386-
expect(futureData.points.length).toEqual(1);
387-
388-
var pt = futureData.points[0];
389-
390-
expect(Object.keys(pt)).toEqual([
391-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
392-
]);
393-
394-
expect(pt.x).toEqual(8);
395-
expect(pt.y).toEqual(18);
396-
expect(pt.curveNumber).toEqual(2);
397-
expect(pt.pointNumber).toEqual(0);
398-
expect(pt.fullData.length).toEqual(3);
399-
expect(typeof pt.data.uid).toEqual('string');
400-
expect(pt.xaxis.domain.length).toEqual(2);
401-
expect(pt.yaxis.domain.length).toEqual(2);
402-
403-
return Plotly.restyle(gd, 'visible', false, [1, 2]);
404-
})
405-
.then(_hover)
406-
.then(function() {
407-
var pt = futureData.points[0];
408-
409-
expect(pt.x).toEqual(8);
410-
expect(pt.y).toEqual(18);
411-
expect(pt.curveNumber).toEqual(2, 'matches input data index');
412-
expect(pt.pointNumber).toEqual(0);
413-
})
414-
.then(done);
207+
var run = makeRunner([540, 150], {
208+
x: 4.5,
209+
y: 9,
210+
curveNumber: 2,
211+
pointNumber: 1
415212
});
416213

417-
it('scattergl-fancy', function(done) {
418-
419-
var modifiedMockCopy = Lib.extendDeep({}, mock4);
420-
modifiedMockCopy.data[0].mode = 'markers+lines';
421-
modifiedMockCopy.data[1].mode = 'markers+lines';
422-
modifiedMockCopy.data[2].mode = 'markers+lines';
423-
424-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
425-
426-
.then(new Promise(function() {
427-
428-
gd.on('plotly_hover', function(data) {
429-
futureData = data;
430-
});
431-
432-
hover(435, 216);
433-
434-
window.setTimeout(function() {
435-
436-
expect(futureData.points.length).toEqual(1);
437-
438-
var pt = futureData.points[0];
439-
440-
expect(Object.keys(pt)).toEqual([
441-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
442-
]);
443-
444-
expect(pt.x).toEqual(8);
445-
expect(pt.y).toEqual(18);
446-
expect(pt.curveNumber).toEqual(2);
447-
expect(pt.pointNumber).toEqual(0);
448-
expect(pt.fullData.length).toEqual(3);
449-
expect(typeof pt.data.uid).toEqual('string');
450-
expect(pt.xaxis.domain.length).toEqual(2);
451-
expect(pt.yaxis.domain.length).toEqual(2);
214+
Plotly.plot(gd, _mock)
215+
.then(run)
216+
.catch(fail)
217+
.then(done);
218+
});
452219

453-
done();
454-
}, 350);
455-
}));
220+
it('should output correct event data for heatmapgl', function(done) {
221+
var _mock = Lib.extendDeep({}, mock3);
222+
_mock.data[0].type = 'heatmapgl';
223+
224+
var run = makeRunner([540, 150], {
225+
x: 3,
226+
y: 3,
227+
curveNumber: 0,
228+
pointNumber: [3, 3]
229+
}, {
230+
noUnHover: true
456231
});
457232

458-
it('contourgl', function(done) {
459-
460-
var modifiedMockCopy = Lib.extendDeep({}, mock3);
461-
462-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
463-
464-
.then(new Promise(function() {
465-
466-
gd.on('plotly_hover', function(data) {
467-
futureData = data;
468-
});
469-
470-
hover(540, 150);
471-
472-
window.setTimeout(function() {
473-
474-
expect(futureData.points.length).toEqual(1);
475-
476-
var pt = futureData.points[0];
477-
478-
expect(Object.keys(pt)).toEqual([
479-
'x', 'y', 'curveNumber', 'pointNumber', 'data', 'fullData', 'xaxis', 'yaxis'
480-
]);
481-
482-
expect(pt.x).toEqual(2);
483-
expect(pt.y).toEqual(3);
484-
expect(pt.curveNumber).toEqual(0);
485-
expect(pt.pointNumber).toEqual([2, 3]);
486-
expect(pt.fullData.length).toEqual(1);
487-
expect(typeof pt.data.uid).toEqual('string');
488-
expect(pt.xaxis.domain.length).toEqual(2);
489-
expect(pt.yaxis.domain.length).toEqual(2);
490-
491-
done();
492-
}, 350);
493-
}));
494-
});
233+
Plotly.plot(gd, _mock)
234+
.then(run)
235+
.catch(fail)
236+
.then(done);
495237
});
496238

497-
describe('click event is fired on click', function() {
498-
var futureData;
499-
500-
it('in general', function(done) {
501-
502-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
503-
504-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
505-
506-
.then(new Promise(function() {
507-
508-
gd.on('plotly_click', function(data) {
509-
futureData = data;
510-
});
511-
512-
click(654.7712871743302, 316.97670766680994);
513-
514-
window.setTimeout(function() {
515-
516-
var pt = futureData.points[0];
517-
518-
check(pt);
519-
520-
done();
521-
522-
}, 350);
523-
}));
239+
it('should output correct event data for scattergl after visibility restyle', function(done) {
240+
var _mock = Lib.extendDeep({}, mock4);
524241

242+
var run = makeRunner([435, 216], {
243+
x: 8,
244+
y: 18,
245+
curveNumber: 2,
246+
pointNumber: 0
525247
});
526248

527-
it('even when hoverinfo (== plotly tooltip) is set to none', function(done) {
528-
529-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
530-
modifiedMockCopy.data[0].hoverinfo = 'none';
531-
532-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
533-
534-
.then(new Promise(function() {
535-
536-
gd.on('plotly_hover', function(data) {
537-
futureData = data;
538-
});
539-
540-
hover(654.7712871743302, 316.97670766680994);
541-
542-
window.setTimeout(function() {
543-
544-
expect(futureData.points.length).toEqual(1);
545-
546-
var pt = futureData.points[0];
547-
548-
check(pt);
549-
550-
done();
551-
}, 250);
552-
}));
553-
249+
Plotly.plot(gd, _mock)
250+
.then(run)
251+
.then(function() {
252+
return Plotly.restyle(gd, 'visible', false, [1]);
253+
})
254+
.then(run)
255+
.catch(fail)
256+
.then(done);
257+
});
554258

259+
it('should output correct event data for scattergl-fancy', function(done) {
260+
var _mock = Lib.extendDeep({}, mock4);
261+
_mock.data[0].mode = 'markers+lines';
262+
_mock.data[1].mode = 'markers+lines';
263+
_mock.data[2].mode = 'markers+lines';
264+
265+
var run = makeRunner([435, 216], {
266+
x: 8,
267+
y: 18,
268+
curveNumber: 2,
269+
pointNumber: 0
555270
});
556271

557-
it('unhover happens', function(done) {
558-
559-
var modifiedMockCopy = Lib.extendDeep({}, mockCopy);
560-
modifiedMockCopy.data[0].hoverinfo = 'none';
561-
562-
Plotly.plot(gd, modifiedMockCopy.data, modifiedMockCopy.layout)
563-
564-
.then(new Promise(function() {
565-
566-
futureData = undefined;
567-
568-
gd.on('plotly_unhover', function() {
569-
futureData = 'emitted plotly_unhover';
570-
});
571-
572-
hover(654.7712871743302, 316.97670766680994);
573-
574-
// fairly realistic simulation of moving with the cursor
575-
window.setTimeout(function() {
576-
577-
var x = 654, y = 316; // we start here
578-
var canceler = window.setInterval(function() {
579-
hover(x--, y++); // move the cursor
580-
}, 10);
581-
582-
window.setTimeout(function() {
583-
window.clearInterval(canceler); // stop the mouse at some point
584-
}, 250);
585-
586-
window.setTimeout(function() {
587-
588-
expect(futureData).toEqual('emitted plotly_unhover');
589-
590-
done();
591-
592-
}, 250);
272+
Plotly.plot(gd, _mock)
273+
.then(run)
274+
.then(function() {
275+
return Plotly.restyle(gd, 'visible', false, [1]);
276+
})
277+
.then(run)
278+
.catch(fail)
279+
.then(done);
280+
});
593281

594-
}, 250);
595-
}));
282+
it('should output correct event data contourgl', function(done) {
283+
var _mock = Lib.extendDeep({}, mock3);
596284

285+
var run = makeRunner([540, 150], {
286+
x: 3,
287+
y: 3,
288+
curveNumber: 0,
289+
pointNumber: [3, 3]
290+
}, {
291+
noUnHover: true
597292
});
598293

294+
Plotly.plot(gd, _mock)
295+
.then(run)
296+
.catch(fail)
297+
.then(done);
599298
});
600299
});

0 commit comments

Comments
 (0)
Please sign in to comment.