Skip to content

Commit

Permalink
Add jasmine test for bugfix #6780
Browse files Browse the repository at this point in the history
  • Loading branch information
Farkites committed Feb 2, 2024
1 parent 5d467c7 commit 9077b78
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions test/jasmine/tests/select_test.js
Expand Up @@ -1599,6 +1599,102 @@ describe('Test select box and lasso in general:', function() {
})
.then(done, done.fail);
});

it('should re-select data in all overlaying visible traces', function(done){
var gd = createGraphDiv();
_newPlot(gd,
[{
x: [1, 2, 3],
y: [4, 5, 6],
name: "yaxis1 data",
type: "scatter"
},
{
x: [2, 3, 4],
y: [40, 50, 60],
name: "yaxis2 data",
yaxis: "y2",
xaxis: "x2",
type: "scatter"
},
{
x: [3, 4, 5],
y: [400, 500, 600],
name: "yaxis3 data",
yaxis: "y3",
type: "scatter"
},
{
x: [4, 5, 6],
y: [1000, 2000, 3000],
name: "yaxis4 data",
yaxis: "y4",
xaxis: "x2",
type: "scatter"
}
], {
grid: {
rows: 2,
columns: 1,
pattern: "independent"
},
width: 800,
height: 800,
yaxis: {
showline: true,
title: {
text: "yaxis title"
}
},
yaxis2: {
title: {
text: "yaxis2 title"
},
showline: true
},
yaxis3: {
title: {
text: "yaxis3 title"
},
anchor: "free",
overlaying: "y",
showline: true,
autoshift: true
},
yaxis4: {
title: {
text: "yaxis4 title"
},
anchor: "free",
overlaying: "y2",
showline: true,
autoshift: true
}
}).then(function() {
return Plotly.relayout(gd, 'dragmode', 'select');
}).then(function () {
return drag([[150, 100], [600, 250]]);
}).then(function() {
expect(gd.data[0].selectedpoints).toEqual([1, 2]);
expect(gd.data[1].selectedpoints).toBe(undefined);
expect(gd.data[2].selectedpoints).toEqual([1]);
expect(gd.data[3].selectedpoints).toBe(undefined);
}).then(function() {
return drag([[600, 175], [780, 175]]); // Extend existing selection
}).then(function() {
expect(gd.data[0].selectedpoints).toEqual([1, 2]);
expect(gd.data[1].selectedpoints).toBe(undefined);
expect(gd.data[2].selectedpoints).toEqual([1, 2]);
expect(gd.data[3].selectedpoints).toBe(undefined);
}).then(function() {
return drag([[150, 600], [780, 300]]);
}).then(function() {
expect(gd.data[0].selectedpoints).toEqual([1, 2]);
expect(gd.data[1].selectedpoints).toEqual([1, 2]);
expect(gd.data[2].selectedpoints).toEqual([1]);
expect(gd.data[3].selectedpoints).toEqual([1, 2]);
}).then(done, done.fail);
});
});

describe('Test select box and lasso per trace:', function() {
Expand Down

0 comments on commit 9077b78

Please sign in to comment.