Skip to content

Commit a3f09da

Browse files
committed
add test for select/lasso on non-visible traces
1 parent 9d72d44 commit a3f09da

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test/jasmine/tests/select_test.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,51 @@ describe('select box and lasso', function() {
286286
});
287287
});
288288
});
289+
290+
it('should skip over non-visible traces', function(done) {
291+
var mockCopy = Lib.extendDeep({}, mock);
292+
mockCopy.layout.dragmode = 'select';
293+
294+
var selectPath = [[100, 200], [150, 200]];
295+
var lassoPath = [[331, 178], [333, 246], [350, 250], [343, 176]];
296+
297+
var gd = createGraphDiv();
298+
var selectedPtLength;
299+
300+
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
301+
gd.on('plotly_selected', function(data) {
302+
selectedPtLength = data.points.length;
303+
});
304+
305+
drag(selectPath);
306+
expect(selectedPtLength).toEqual(2, '(case 0)');
307+
308+
return Plotly.restyle(gd, 'visible', 'legendonly');
309+
}).then(function() {
310+
drag(selectPath);
311+
expect(selectedPtLength).toEqual(0, '(legendonly case)');
312+
313+
return Plotly.restyle(gd, 'visible', true);
314+
}).then(function() {
315+
drag(selectPath);
316+
expect(selectedPtLength).toEqual(2, '(back to case 0)');
317+
318+
return Plotly.relayout(gd, 'dragmode', 'lasso');
319+
}).then(function() {
320+
drag(lassoPath);
321+
expect(selectedPtLength).toEqual(1, '(case 0 lasso)');
322+
323+
return Plotly.restyle(gd, 'visible', 'legendonly');
324+
}).then(function() {
325+
drag(lassoPath);
326+
expect(selectedPtLength).toEqual(0, '(lasso legendonly case)');
327+
328+
return Plotly.restyle(gd, 'visible', true);
329+
}).then(function() {
330+
drag(lassoPath);
331+
expect(selectedPtLength).toEqual(1, '(back to lasso case 0)');
332+
333+
done();
334+
});
335+
});
289336
});

0 commit comments

Comments
 (0)