@@ -254,7 +254,7 @@ describe('Test plot api', function() {
254254 } ) ;
255255 } ) ;
256256
257- describe ( 'Plotly.restyle' , function ( ) {
257+ describe ( 'Plotly.restyle subroutines switchboard ' , function ( ) {
258258 beforeEach ( function ( ) {
259259 spyOn ( PlotlyInternal , 'plot' ) ;
260260 spyOn ( Plots , 'previousPromises' ) ;
@@ -330,6 +330,36 @@ describe('Test plot api', function() {
330330 expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
331331 } ) ;
332332
333+ it ( 'should do full replot when arrayOk base attributes are updated' , function ( ) {
334+ var gd = {
335+ data : [ { x : [ 1 , 2 , 3 ] , y : [ 1 , 2 , 3 ] } ] ,
336+ layout : { }
337+ } ;
338+
339+ mockDefaultsAndCalc ( gd ) ;
340+ Plotly . restyle ( gd , 'hoverlabel.bgcolor' , [ [ 'red' , 'green' , 'blue' ] ] ) ;
341+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
342+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
343+
344+ mockDefaultsAndCalc ( gd ) ;
345+ PlotlyInternal . plot . calls . reset ( ) ;
346+ Plotly . restyle ( gd , 'hoverlabel.bgcolor' , 'yellow' ) ;
347+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
348+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
349+
350+ mockDefaultsAndCalc ( gd ) ;
351+ PlotlyInternal . plot . calls . reset ( ) ;
352+ Plotly . restyle ( gd , 'hoverlabel.bgcolor' , 'blue' ) ;
353+ expect ( gd . calcdata ) . toBeDefined ( ) ;
354+ expect ( PlotlyInternal . plot ) . not . toHaveBeenCalled ( ) ;
355+
356+ mockDefaultsAndCalc ( gd ) ;
357+ PlotlyInternal . plot . calls . reset ( ) ;
358+ Plotly . restyle ( gd , 'hoverlabel.bgcolor' , [ [ 'red' , 'blue' , 'green' ] ] ) ;
359+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
360+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
361+ } ) ;
362+
333363 it ( 'should do full replot when attribute container are updated' , function ( ) {
334364 var gd = {
335365 data : [ { x : [ 1 , 2 , 3 ] , y : [ 1 , 2 , 3 ] } ] ,
0 commit comments