File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -319,11 +319,11 @@ exports.cleanData = function(data) {
319319
320320 // scl->scale, reversescl->reversescale
321321 if ( 'scl' in trace ) {
322- trace . colorscale = trace . scl ;
322+ if ( ! ( 'colorscale' in trace ) ) { trace . colorscale = trace . scl ; }
323323 delete trace . scl ;
324324 }
325325 if ( 'reversescl' in trace ) {
326- trace . reversescale = trace . reversescl ;
326+ if ( ! ( 'reversescale' in trace ) ) { trace . reversescale = trace . reversescl ; }
327327 delete trace . reversescl ;
328328 }
329329
Original file line number Diff line number Diff line change @@ -2254,6 +2254,52 @@ describe('Test plot api', function() {
22542254
22552255 afterEach ( destroyGraphDiv ) ;
22562256
2257+ it ( 'should rename \'scl\' to \'colorscale\' when colorscale is not defined' , function ( ) {
2258+ var data = [ {
2259+ type : 'heatmap' ,
2260+ scl : 'Blues'
2261+ } ] ;
2262+
2263+ Plotly . plot ( gd , data ) ;
2264+ expect ( gd . data [ 0 ] . colorscale ) . toBe ( 'Blues' ) ;
2265+ expect ( gd . data [ 0 ] . scl ) . toBe ( undefined ) ;
2266+ } ) ;
2267+
2268+ it ( 'should not rename \'scl\' to \'colorscale\' when colorscale is defined ' , function ( ) {
2269+ var data = [ {
2270+ type : 'heatmap' ,
2271+ colorscale : 'Greens' ,
2272+ scl : 'Reds'
2273+ } ] ;
2274+
2275+ Plotly . plot ( gd , data ) ;
2276+ expect ( gd . data [ 0 ] . colorscale ) . toBe ( 'Greens' ) ;
2277+ expect ( gd . data [ 0 ] . scl ) . toBe ( undefined ) ;
2278+ } ) ;
2279+
2280+ it ( 'should rename \'reversescl\' to \'reversescale\' when colorscale is not defined' , function ( ) {
2281+ var data = [ {
2282+ type : 'heatmap' ,
2283+ reversescl : true
2284+ } ] ;
2285+
2286+ Plotly . plot ( gd , data ) ;
2287+ expect ( gd . data [ 0 ] . reversescale ) . toBe ( true ) ;
2288+ expect ( gd . data [ 0 ] . reversescl ) . toBe ( undefined ) ;
2289+ } ) ;
2290+
2291+ it ( 'should not rename \'scl\' to \'colorscale\' when colorscale is defined ' , function ( ) {
2292+ var data = [ {
2293+ type : 'heatmap' ,
2294+ reversescale : true ,
2295+ reversescl : false
2296+ } ] ;
2297+
2298+ Plotly . plot ( gd , data ) ;
2299+ expect ( gd . data [ 0 ] . reversescale ) . toBe ( true ) ;
2300+ expect ( gd . data [ 0 ] . reversescl ) . toBe ( undefined ) ;
2301+ } ) ;
2302+
22572303 it ( 'should rename \'YIGnBu\' colorscales YlGnBu (2dMap case)' , function ( ) {
22582304 var data = [ {
22592305 type : 'heatmap' ,
You can’t perform that action at this time.
0 commit comments