@@ -1052,18 +1052,17 @@ describe('Test plot api', function() {
10521052
10531053 it ( 'should redo auto z/contour when editing z array' , function ( done ) {
10541054 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 ) ;
10591058 expect ( gd . data [ 0 ] . autocontour ) . toBe ( true ) ;
10601059 expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 1.5 , end : 3.5 , size : 0.5 } ) ;
10611060
10621061 return Plotly . restyle ( gd , { 'z[0][0]' : 10 } ) ;
10631062 } ) . 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 ) ;
10671066 expect ( gd . data [ 0 ] . contours ) . toEqual ( { start : 3 , end : 9 , size : 1 } ) ;
10681067 } )
10691068 . catch ( failTest )
@@ -1111,10 +1110,10 @@ describe('Test plot api', function() {
11111110 var zmax1 = 10 ;
11121111
11131112 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 ) ;
11181117 }
11191118
11201119 Plotly . plot ( gd , [
@@ -1144,32 +1143,32 @@ describe('Test plot api', function() {
11441143 } ) ;
11451144
11461145 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 ;
11481147
1148+ var autocscale = scales . Reds ;
1149+ var mcscl0 = 'Rainbow' ;
1150+ var mlcscl1 = 'Greens' ;
11491151 var mcmin0 = 3 ;
1150- var mcscl0 = 'rainbow' ;
11511152 var mlcmax1 = 6 ;
1152- var mlcscl1 = 'greens' ;
11531153
11541154 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 ) ;
11571157 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 ) ;
11611162 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 ] ) ;
11631164 }
11641165
11651166 Plotly . plot ( gd , [
11661167 { y : [ 1 , 2 ] , mode : 'markers' , marker : { color : [ 1 , 10 ] } } ,
11671168 { y : [ 2 , 1 ] , mode : 'markers' , marker : { line : { width : 2 , color : [ 3 , 4 ] } } }
11681169 ] )
11691170 . 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' ) ;
11731172 return Plotly . restyle ( gd , { 'marker.cmin' : mcmin0 , 'marker.colorscale' : mcscl0 } , null , [ 0 ] ) ;
11741173 } )
11751174 . then ( function ( ) {
0 commit comments