@@ -1052,18 +1052,17 @@ describe('Test plot api', function() {
1052
1052
1053
1053
it ( 'should redo auto z/contour when editing z array' , function ( done ) {
1054
1054
Plotly . plot ( gd , [ { type : 'contour' , z : [ [ 1 , 2 ] , [ 3 , 4 ] ] } ] ) . then ( function ( ) {
1055
- expect ( gd . data [ 0 ] . zauto ) . toBe ( true , gd . data [ 0 ] ) ;
1056
- expect ( gd . data [ 0 ] . zmin ) . toBe ( 1 ) ;
1057
- expect ( gd . data [ 0 ] . zmax ) . toBe ( 4 ) ;
1058
-
1055
+ expect ( gd . _fullData [ 0 ] . zauto ) . toBe ( true ) ;
1056
+ expect ( gd . _fullData [ 0 ] . zmin ) . toBe ( 1 ) ;
1057
+ expect ( gd . _fullData [ 0 ] . zmax ) . toBe ( 4 ) ;
1059
1058
expect ( gd . data [ 0 ] . autocontour ) . toBe ( true ) ;
1060
1059
expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 1.5 , end : 3.5 , size : 0.5 } ) ;
1061
1060
1062
1061
return Plotly . restyle ( gd , { 'z[0][0]' : 10 } ) ;
1063
1062
} ) . then ( function ( ) {
1064
- expect ( gd . data [ 0 ] . zmin ) . toBe ( 2 ) ;
1065
- expect ( gd . data [ 0 ] . zmax ) . toBe ( 10 ) ;
1066
-
1063
+ expect ( gd . _fullData [ 0 ] . zauto ) . toBe ( true ) ;
1064
+ expect ( gd . _fullData [ 0 ] . zmin ) . toBe ( 2 ) ;
1065
+ expect ( gd . _fullData [ 0 ] . zmax ) . toBe ( 10 ) ;
1067
1066
expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 3 , end : 9 , size : 1 } ) ;
1068
1067
} )
1069
1068
. catch ( failTest )
@@ -1111,10 +1110,10 @@ describe('Test plot api', function() {
1111
1110
var zmax1 = 10 ;
1112
1111
1113
1112
function check ( auto , msg ) {
1114
- expect ( gd . data [ 0 ] . zmin ) . negateIf ( auto ) . toBe ( zmin0 , msg ) ;
1115
- expect ( gd . data [ 0 ] . zauto ) . toBe ( auto , msg ) ;
1116
- expect ( gd . data [ 1 ] . zmax ) . negateIf ( auto ) . toBe ( zmax1 , msg ) ;
1117
- expect ( gd . data [ 1 ] . zauto ) . toBe ( auto , msg ) ;
1113
+ expect ( gd . _fullData [ 0 ] . zmin ) . negateIf ( auto ) . toBe ( zmin0 , msg ) ;
1114
+ expect ( gd . _fullData [ 0 ] . zauto ) . toBe ( auto , msg ) ;
1115
+ expect ( gd . _fullData [ 1 ] . zmax ) . negateIf ( auto ) . toBe ( zmax1 , msg ) ;
1116
+ expect ( gd . _fullData [ 1 ] . zauto ) . toBe ( auto , msg ) ;
1118
1117
}
1119
1118
1120
1119
Plotly . plot ( gd , [
@@ -1144,32 +1143,32 @@ describe('Test plot api', function() {
1144
1143
} ) ;
1145
1144
1146
1145
it ( 'turns off cauto (autocolorscale) when you edit cmin or cmax (colorscale)' , function ( done ) {
1147
- var autocscale = require ( '@src/components/colorscale/scales' ) . scales . Reds ;
1146
+ var scales = require ( '@src/components/colorscale/scales' ) . scales ;
1148
1147
1148
+ var autocscale = scales . Reds ;
1149
+ var mcscl0 = 'Rainbow' ;
1150
+ var mlcscl1 = 'Greens' ;
1149
1151
var mcmin0 = 3 ;
1150
- var mcscl0 = 'rainbow' ;
1151
1152
var mlcmax1 = 6 ;
1152
- var mlcscl1 = 'greens' ;
1153
1153
1154
1154
function check ( auto , autocolorscale , msg ) {
1155
- expect ( gd . data [ 0 ] . marker . cauto ) . toBe ( auto , msg ) ;
1156
- expect ( gd . data [ 0 ] . marker . cmin ) . negateIf ( auto ) . toBe ( mcmin0 ) ;
1155
+ expect ( gd . _fullData [ 0 ] . marker . cauto ) . toBe ( auto , msg ) ;
1156
+ expect ( gd . _fullData [ 0 ] . marker . cmin ) . negateIf ( auto ) . toBe ( mcmin0 ) ;
1157
1157
expect ( gd . _fullData [ 0 ] . marker . autocolorscale ) . toBe ( autocolorscale , msg ) ;
1158
- expect ( gd . data [ 0 ] . marker . colorscale ) . toEqual ( auto ? autocscale : mcscl0 ) ;
1159
- expect ( gd . data [ 1 ] . marker . line . cauto ) . toBe ( auto , msg ) ;
1160
- expect ( gd . data [ 1 ] . marker . line . cmax ) . negateIf ( auto ) . toBe ( mlcmax1 ) ;
1158
+ expect ( gd . _fullData [ 0 ] . marker . colorscale ) . toEqual ( auto ? autocscale : scales [ mcscl0 ] ) ;
1159
+
1160
+ expect ( gd . _fullData [ 1 ] . marker . line . cauto ) . toBe ( auto , msg ) ;
1161
+ expect ( gd . _fullData [ 1 ] . marker . line . cmax ) . negateIf ( auto ) . toBe ( mlcmax1 ) ;
1161
1162
expect ( gd . _fullData [ 1 ] . marker . line . autocolorscale ) . toBe ( autocolorscale , msg ) ;
1162
- expect ( gd . data [ 1 ] . marker . line . colorscale ) . toEqual ( auto ? autocscale : mlcscl1 ) ;
1163
+ expect ( gd . _fullData [ 1 ] . marker . line . colorscale ) . toEqual ( auto ? autocscale : scales [ mlcscl1 ] ) ;
1163
1164
}
1164
1165
1165
1166
Plotly . plot ( gd , [
1166
1167
{ y : [ 1 , 2 ] , mode : 'markers' , marker : { color : [ 1 , 10 ] } } ,
1167
1168
{ y : [ 2 , 1 ] , mode : 'markers' , marker : { line : { width : 2 , color : [ 3 , 4 ] } } }
1168
1169
] )
1169
1170
. then ( function ( ) {
1170
- // autocolorscale is actually true after supplyDefaults, but during calc it's set
1171
- // to false when we push the resulting colorscale back to the input container
1172
- check ( true , false , 'initial' ) ;
1171
+ check ( true , true , 'initial' ) ;
1173
1172
return Plotly . restyle ( gd , { 'marker.cmin' : mcmin0 , 'marker.colorscale' : mcscl0 } , null , [ 0 ] ) ;
1174
1173
} )
1175
1174
. then ( function ( ) {
0 commit comments