Skip to content

Commit aa17f1b

Browse files
committed
sankey: test to 🔒 down grouping via mouse selection
1 parent 20d8c92 commit aa17f1b

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/traces/sankey/base_plot.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ function subplotUpdateFx(gd, index) {
5757
var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
5858
var bgRect = trace._bgRect;
5959

60+
if(dragMode === 'pan' || dragMode === 'zoom') return;
61+
6062
setCursor(bgRect, cursor);
6163

6264
var xaxis = {

test/jasmine/tests/select_test.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,47 @@ describe('Test select box and lasso per trace:', function() {
26662666
.catch(failTest)
26672667
.then(done);
26682668
});
2669+
2670+
it('@flaky should work on sankey traces', function(done) {
2671+
var fig = Lib.extendDeep({}, require('@mocks/sankey_circular.json'));
2672+
fig.layout.dragmode = 'select';
2673+
var dblClickPos = [250, 400];
2674+
var opts = {};
2675+
2676+
Plotly.plot(gd, fig)
2677+
.then(function() {
2678+
// No groups initially
2679+
expect(gd._fullData[0].node.groups).toEqual([]);
2680+
2681+
opts.element = document.elementFromPoint(400, 400);
2682+
})
2683+
.then(function() {
2684+
// Grouping the two nodes on the top right
2685+
return _run(
2686+
[[640, 130], [400, 450]],
2687+
function() {
2688+
expect(gd._fullData[0].node.groups).toEqual([[2, 3]]);
2689+
},
2690+
dblClickPos, BOXEVENTS, 'for top right nodes #2 and #3'
2691+
);
2692+
})
2693+
.then(function() {
2694+
// Grouping node #4 and the previous group
2695+
drag([[715, 400], [300, 110]], opts);
2696+
})
2697+
.then(function() {
2698+
expect(gd._fullData[0].node.groups).toEqual([[4, 3, 2]]);
2699+
})
2700+
.then(function() {
2701+
// Grouping node #0 and #1 on the left side
2702+
drag([[160, 110], [200, 590]], opts);
2703+
})
2704+
.then(function() {
2705+
expect(gd._fullData[0].node.groups).toEqual([[4, 3, 2], [0, 1]]);
2706+
})
2707+
.catch(failTest)
2708+
.then(done);
2709+
});
26692710
});
26702711

26712712
describe('Test that selections persist:', function() {

0 commit comments

Comments
 (0)