Skip to content

Commit 53c548f

Browse files
committed
Add opacity change test
1 parent a9d387a commit 53c548f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

test/jasmine/tests/gl2d_plot_interact_test.js

+26-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var Plotly = require('@lib/index');
44
var Plots = require('@src/plots/plots');
55
var Lib = require('@src/lib');
66
var Drawing = require('@src/components/drawing');
7+
var ScatterGl = require('@src/traces/scattergl');
78

89
var createGraphDiv = require('../assets/create_graph_div');
910
var destroyGraphDiv = require('../assets/destroy_graph_div');
@@ -14,6 +15,7 @@ var selectButton = require('../assets/modebar_button');
1415
var delay = require('../assets/delay');
1516
var readPixel = require('../assets/read_pixel');
1617

18+
1719
function countCanvases() {
1820
return d3.selectAll('canvas').size();
1921
}
@@ -406,7 +408,6 @@ describe('Test gl2d plots', function() {
406408
.then(done);
407409
});
408410

409-
410411
it('@noCI should display selection of big number of miscellaneous points', function(done) {
411412
var colorList = [
412413
'#006385', '#F06E75', '#90ed7d', '#f7a35c', '#8085e9',
@@ -645,4 +646,28 @@ describe('Test gl2d plots', function() {
645646
.catch(fail)
646647
.then(done);
647648
});
649+
650+
it('should restyle opacity', function(done) {
651+
// #2299
652+
spyOn(ScatterGl, 'calc');
653+
654+
var dat = [{
655+
'x': [1, 2, 3],
656+
'y': [1, 2, 3],
657+
'type': 'scattergl',
658+
'mode': 'markers'
659+
}];
660+
661+
Plotly.plot(gd, dat, {width: 500, height: 500})
662+
.then(function() {
663+
expect(ScatterGl.calc).toHaveBeenCalledTimes(1);
664+
665+
return Plotly.restyle(gd, {'opacity': 0.1});
666+
})
667+
.then(function() {
668+
expect(ScatterGl.calc).toHaveBeenCalledTimes(2);
669+
})
670+
.catch(fail)
671+
.then(done);
672+
});
648673
});

0 commit comments

Comments
 (0)