@@ -1101,6 +1101,42 @@ describe('Test colorscale restyle calls:', function() {
11011101 . then ( done ) ;
11021102 } ) ;
11031103
1104+ it ( 'should update coloraxis cmin/cmax on color value changes' , function ( done ) {
1105+ function fig ( mc ) {
1106+ return {
1107+ data : [ {
1108+ mode : 'markers' ,
1109+ y : [ 1 , 2 , 3 ] ,
1110+ marker : {
1111+ coloraxis : 'coloraxis' ,
1112+ color : mc
1113+ }
1114+ } ]
1115+ } ;
1116+ }
1117+
1118+ function _assert ( msg , cmin , cmax ) {
1119+ return function ( ) {
1120+ var cOpts = gd . _fullLayout . coloraxis ;
1121+ expect ( cOpts . cmin ) . toBe ( cmin , msg + '| cmin' ) ;
1122+ expect ( cOpts . cmax ) . toBe ( cmax , msg + '| cmax' ) ;
1123+ } ;
1124+ }
1125+
1126+ Plotly . react ( gd , fig ( [ 1 , 2 , 3 ] ) )
1127+ . then ( _assert ( 'marker.color [1,2,3]' , 1 , 3 ) )
1128+ . then ( function ( ) { return Plotly . react ( gd , fig ( [ 1 , 5 , 3 ] ) ) ; } )
1129+ . then ( _assert ( 'marker.color [1,5,3]' , 1 , 5 ) )
1130+ . then ( function ( ) { return Plotly . react ( gd , fig ( [ 1 , 2 , 3 ] ) ) ; } )
1131+ . then ( _assert ( 'back to marker.color [1,2,3]' , 1 , 3 ) )
1132+ . then ( function ( ) { return Plotly . react ( gd , fig ( [ - 1 , 2 , 3 ] ) ) ; } )
1133+ . then ( _assert ( 'marker.color [-1,2,3]' , - 1 , 3 ) )
1134+ . then ( function ( ) { return Plotly . react ( gd , fig ( [ 1 , 2 , 3 ] ) ) ; } )
1135+ . then ( _assert ( 'back again to marker.color [1,2,3]' , 1 , 3 ) )
1136+ . catch ( failTest )
1137+ . then ( done ) ;
1138+ } ) ;
1139+
11041140 it ( 'should work with templates' , function ( done ) {
11051141 function _assert ( msg , exp ) {
11061142 var mcc = [ ] ;
0 commit comments