@@ -4,6 +4,7 @@ var Plotly = require('@lib/index');
44var Plots = require ( '@src/plots/plots' ) ;
55var Lib = require ( '@src/lib' ) ;
66var Drawing = require ( '@src/components/drawing' ) ;
7+ var ScatterGl = require ( '@src/traces/scattergl' ) ;
78
89var createGraphDiv = require ( '../assets/create_graph_div' ) ;
910var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
@@ -14,6 +15,7 @@ var selectButton = require('../assets/modebar_button');
1415var delay = require ( '../assets/delay' ) ;
1516var readPixel = require ( '../assets/read_pixel' ) ;
1617
18+
1719function 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