@@ -285,6 +285,36 @@ describe('Test plot api', function() {
285285 expect ( gd . calcdata ) . toBeDefined ( ) ;
286286 } ) ;
287287
288+ it ( 'should do full replot when arrayOk attributes are updated' , function ( ) {
289+ var gd = {
290+ data : [ { x : [ 1 , 2 , 3 ] , y : [ 1 , 2 , 3 ] } ] ,
291+ layout : { }
292+ } ;
293+
294+ mockDefaultsAndCalc ( gd ) ;
295+ Plotly . restyle ( gd , 'marker.color' , [ [ 'red' , 'green' , 'blue' ] ] ) ;
296+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
297+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
298+
299+ mockDefaultsAndCalc ( gd ) ;
300+ PlotlyInternal . plot . calls . reset ( ) ;
301+ Plotly . restyle ( gd , 'marker.color' , 'yellow' ) ;
302+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
303+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
304+
305+ mockDefaultsAndCalc ( gd ) ;
306+ PlotlyInternal . plot . calls . reset ( ) ;
307+ Plotly . restyle ( gd , 'marker.color' , 'blue' ) ;
308+ expect ( gd . calcdata ) . toBeDefined ( ) ;
309+ expect ( PlotlyInternal . plot ) . not . toHaveBeenCalled ( ) ;
310+
311+ mockDefaultsAndCalc ( gd ) ;
312+ PlotlyInternal . plot . calls . reset ( ) ;
313+ Plotly . restyle ( gd , 'marker.color' , [ [ 'red' , 'blue' , 'green' ] ] ) ;
314+ expect ( gd . calcdata ) . toBeUndefined ( ) ;
315+ expect ( PlotlyInternal . plot ) . toHaveBeenCalled ( ) ;
316+ } ) ;
317+
288318 it ( 'calls plot on xgap and ygap styling' , function ( ) {
289319 var gd = {
290320 data : [ { z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] , [ 7 , 8 , 9 ] ] , showscale : false , type : 'heatmap' } ] ,
0 commit comments