@@ -4,6 +4,7 @@ var Plotly = require('@lib/index');
4
4
var Plots = require ( '@src/plots/plots' ) ;
5
5
var Lib = require ( '@src/lib' ) ;
6
6
var Drawing = require ( '@src/components/drawing' ) ;
7
+ var ScatterGl = require ( '@src/traces/scattergl' ) ;
7
8
8
9
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
9
10
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -14,6 +15,7 @@ var selectButton = require('../assets/modebar_button');
14
15
var delay = require ( '../assets/delay' ) ;
15
16
var readPixel = require ( '../assets/read_pixel' ) ;
16
17
18
+
17
19
function countCanvases ( ) {
18
20
return d3 . selectAll ( 'canvas' ) . size ( ) ;
19
21
}
@@ -406,7 +408,6 @@ describe('Test gl2d plots', function() {
406
408
. then ( done ) ;
407
409
} ) ;
408
410
409
-
410
411
it ( '@noCI should display selection of big number of miscellaneous points' , function ( done ) {
411
412
var colorList = [
412
413
'#006385' , '#F06E75' , '#90ed7d' , '#f7a35c' , '#8085e9' ,
@@ -645,4 +646,28 @@ describe('Test gl2d plots', function() {
645
646
. catch ( fail )
646
647
. then ( done ) ;
647
648
} ) ;
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
+ } ) ;
648
673
} ) ;
0 commit comments