Skip to content

Commit 091883c

Browse files
committed
Add select/lasso click event test
1 parent 20491b2 commit 091883c

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

test/jasmine/tests/gl2d_click_test.js

+78
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,84 @@ describe('Test hover and click interactions', function() {
221221
.then(done);
222222
});
223223

224+
it('should output correct event data for scattergl in *select* dragmode', function(done) {
225+
var _mock = Lib.extendDeep({}, mock1);
226+
227+
_mock.layout.dragmode = 'select';
228+
229+
_mock.layout.hoverlabel = {
230+
font: {
231+
size: 20,
232+
color: 'yellow'
233+
}
234+
};
235+
_mock.data[0].hoverinfo = _mock.data[0].x.map(function(_, i) { return i % 2 ? 'y' : 'x'; });
236+
237+
_mock.data[0].hoverlabel = {
238+
bgcolor: 'blue',
239+
bordercolor: _mock.data[0].x.map(function(_, i) { return i % 2 ? 'red' : 'green'; })
240+
};
241+
242+
var run = makeRunner([634, 321], {
243+
x: 15.772,
244+
y: 0.387,
245+
label: ['0.387', null],
246+
curveNumber: 0,
247+
pointNumber: 33,
248+
bgcolor: 'rgb(0, 0, 255)',
249+
bordercolor: 'rgb(255, 0, 0)',
250+
fontSize: 20,
251+
fontFamily: 'Arial',
252+
fontColor: 'rgb(255, 255, 0)'
253+
}, {
254+
msg: 'scattergl'
255+
});
256+
257+
Plotly.plot(gd, _mock)
258+
.then(run)
259+
.catch(fail)
260+
.then(done);
261+
});
262+
263+
it('should output correct event data for scattergl in *lasso* dragmode', function(done) {
264+
var _mock = Lib.extendDeep({}, mock1);
265+
266+
_mock.layout.dragmode = 'lasso';
267+
268+
_mock.layout.hoverlabel = {
269+
font: {
270+
size: 20,
271+
color: 'yellow'
272+
}
273+
};
274+
_mock.data[0].hoverinfo = _mock.data[0].x.map(function(_, i) { return i % 2 ? 'y' : 'x'; });
275+
276+
_mock.data[0].hoverlabel = {
277+
bgcolor: 'blue',
278+
bordercolor: _mock.data[0].x.map(function(_, i) { return i % 2 ? 'red' : 'green'; })
279+
};
280+
281+
var run = makeRunner([634, 321], {
282+
x: 15.772,
283+
y: 0.387,
284+
label: ['0.387', null],
285+
curveNumber: 0,
286+
pointNumber: 33,
287+
bgcolor: 'rgb(0, 0, 255)',
288+
bordercolor: 'rgb(255, 0, 0)',
289+
fontSize: 20,
290+
fontFamily: 'Arial',
291+
fontColor: 'rgb(255, 255, 0)'
292+
}, {
293+
msg: 'scattergl'
294+
});
295+
296+
Plotly.plot(gd, _mock)
297+
.then(run)
298+
.catch(fail)
299+
.then(done);
300+
});
301+
224302
it('should output correct event data for scattergl with hoverinfo: \'none\'', function(done) {
225303
var _mock = Lib.extendDeep({}, mock1);
226304
_mock.data[0].hoverinfo = 'none';

0 commit comments

Comments
 (0)