@@ -1195,6 +1195,77 @@ describe('Test plot api', function() {
1195
1195
. then ( done ) ;
1196
1196
} ) ;
1197
1197
1198
+ it ( 'turns on cauto when cmid is edited' , function ( done ) {
1199
+ function _assert ( msg , exp ) {
1200
+ return function ( ) {
1201
+ var mk = gd . _fullData [ 0 ] . marker ;
1202
+ for ( var k in exp ) {
1203
+ expect ( mk [ k ] ) . toBe ( exp [ k ] , [ msg , k ] . join ( ' - ' ) ) ;
1204
+ }
1205
+ } ;
1206
+ }
1207
+
1208
+ function _restyle ( arg ) {
1209
+ return function ( ) { return Plotly . restyle ( gd , arg ) ; } ;
1210
+ }
1211
+
1212
+ Plotly . plot ( gd , [ {
1213
+ mode : 'markers' ,
1214
+ y : [ 1 , 2 , 1 ] ,
1215
+ marker : { color : [ 1 , - 1 , 4 ] }
1216
+ } ] )
1217
+ . then ( _assert ( 'base' , {
1218
+ cauto : true ,
1219
+ cmid : undefined ,
1220
+ cmin : - 1 ,
1221
+ cmax : 4
1222
+ } ) )
1223
+ . then ( _restyle ( { 'marker.cmid' : 0 } ) )
1224
+ . then ( _assert ( 'set cmid=0' , {
1225
+ cauto : true ,
1226
+ cmid : 0 ,
1227
+ cmin : - 4 ,
1228
+ cmax : 4
1229
+ } ) )
1230
+ . then ( _restyle ( { 'marker.cmid' : - 2 } ) )
1231
+ . then ( _assert ( 'set cmid=-2' , {
1232
+ cauto : true ,
1233
+ cmid : - 2 ,
1234
+ cmin : - 8 ,
1235
+ cmax : 4
1236
+ } ) )
1237
+ . then ( _restyle ( { 'marker.cmid' : 2 } ) )
1238
+ . then ( _assert ( 'set cmid=2' , {
1239
+ cauto : true ,
1240
+ cmid : 2 ,
1241
+ cmin : - 1 ,
1242
+ cmax : 5
1243
+ } ) )
1244
+ . then ( _restyle ( { 'marker.cmin' : 0 } ) )
1245
+ . then ( _assert ( 'set cmin=0' , {
1246
+ cauto : false ,
1247
+ cmid : undefined ,
1248
+ cmin : 0 ,
1249
+ cmax : 5
1250
+ } ) )
1251
+ . then ( _restyle ( { 'marker.cmax' : 10 } ) )
1252
+ . then ( _assert ( 'set cmin=0 + cmax=10' , {
1253
+ cauto : false ,
1254
+ cmid : undefined ,
1255
+ cmin : 0 ,
1256
+ cmax : 10
1257
+ } ) )
1258
+ . then ( _restyle ( { 'marker.cauto' : true , 'marker.cmid' : null } ) )
1259
+ . then ( _assert ( 'back to cauto=true' , {
1260
+ cauto : true ,
1261
+ cmid : undefined ,
1262
+ cmin : - 1 ,
1263
+ cmax : 4
1264
+ } ) )
1265
+ . catch ( failTest )
1266
+ . then ( done ) ;
1267
+ } ) ;
1268
+
1198
1269
it ( 'turns off autobin when you edit bin specs' , function ( done ) {
1199
1270
// test retained (modified) for backward compat with new autobin logic
1200
1271
var start0 = 0.2 ;
0 commit comments