Skip to content

Commit 4e66ff5

Browse files
committed
Add #2298 test
1 parent 1da7796 commit 4e66ff5

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

test/jasmine/tests/gl2d_plot_interact_test.js

+44-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,50 @@ describe('Test gl2d plots', function() {
671671
.then(done);
672672
});
673673

674-
fit('should update selected points', function(done) {
674+
it('should update selected points', function(done) {
675675
// #2298
676+
var dat = [{
677+
'x': [1],
678+
'y': [1],
679+
'type': 'scattergl',
680+
'mode': 'markers',
681+
'selectedpoints': [0]
682+
}];
683+
684+
Plotly.plot(gd, dat, {
685+
width: 500,
686+
height: 500,
687+
dragmode: 'select'
688+
})
689+
.then(function() {
690+
var scene = gd._fullLayout._plots.xy._scene;
691+
692+
expect(scene.count).toBe(1);
693+
expect(scene.selectBatch).toEqual([[0]]);
694+
expect(scene.unselectBatch).toEqual([[]]);
695+
spyOn(scene.scatter2d, 'draw');
696+
697+
var trace = {
698+
x: [2],
699+
y: [1],
700+
type: 'scattergl',
701+
mode: 'markers',
702+
marker: {color: 'red'}
703+
};
704+
705+
return Plotly.addTraces(gd, trace);
706+
})
707+
.then(function() {
708+
var scene = gd._fullLayout._plots.xy._scene;
709+
710+
expect(scene.count).toBe(2);
711+
expect(scene.selectBatch).toEqual([[0], []]);
712+
expect(scene.unselectBatch).toEqual([[], [0]]);
713+
expect(scene.markerOptions.length).toBe(2);
714+
expect(scene.markerOptions[1].color).toEqual(new Uint8Array([255, 0, 0, 255]));
715+
expect(scene.scatter2d.draw).toHaveBeenCalled();
716+
})
717+
.catch(fail)
718+
.then(done);
676719
});
677720
});

0 commit comments

Comments
 (0)