Skip to content

Commit 168bb68

Browse files
committed
revised in respect to 1st review
1 parent f2c4791 commit 168bb68

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/plot_api/helpers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ exports.cleanData = function(data) {
318318
}
319319

320320
// scl->scale, reversescl->reversescale
321-
if('scl' in trace) {
322-
if(!('colorscale' in trace)) { trace.colorscale = trace.scl; }
321+
if('scl' in trace && !('colorscale' in trace)) {
322+
trace.colorscale = trace.scl;
323323
delete trace.scl;
324324
}
325-
if('reversescl' in trace) {
326-
if(!('reversescale' in trace)) { trace.reversescale = trace.reversescl; }
325+
if('reversescl' in trace && !('reversescale' in trace)) {
326+
trace.reversescale = trace.reversescl;
327327
delete trace.reversescl;
328328
}
329329

test/jasmine/tests/plot_api_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ describe('Test plot api', function() {
22652265
expect(gd.data[0].scl).toBe(undefined);
22662266
});
22672267

2268-
it('should not rename \'scl\' to \'colorscale\' when colorscale is defined ', function() {
2268+
it('should not delete rename \'scl\' to \'colorscale\' when colorscale is defined ', function() {
22692269
var data = [{
22702270
type: 'heatmap',
22712271
colorscale: 'Greens',
@@ -2274,7 +2274,7 @@ describe('Test plot api', function() {
22742274

22752275
Plotly.plot(gd, data);
22762276
expect(gd.data[0].colorscale).toBe('Greens');
2277-
expect(gd.data[0].scl).toBe(undefined);
2277+
expect(gd.data[0].scl).not.toBe(undefined);
22782278
});
22792279

22802280
it('should rename \'reversescl\' to \'reversescale\' when colorscale is not defined', function() {
@@ -2288,7 +2288,7 @@ describe('Test plot api', function() {
22882288
expect(gd.data[0].reversescl).toBe(undefined);
22892289
});
22902290

2291-
it('should not rename \'scl\' to \'colorscale\' when colorscale is defined ', function() {
2291+
it('should not delete & rename \'reversescl\' to \'reversescale\' when colorscale is defined', function() {
22922292
var data = [{
22932293
type: 'heatmap',
22942294
reversescale: true,
@@ -2297,7 +2297,7 @@ describe('Test plot api', function() {
22972297

22982298
Plotly.plot(gd, data);
22992299
expect(gd.data[0].reversescale).toBe(true);
2300-
expect(gd.data[0].reversescl).toBe(undefined);
2300+
expect(gd.data[0].reversescl).not.toBe(undefined);
23012301
});
23022302

23032303
it('should rename \'YIGnBu\' colorscales YlGnBu (2dMap case)', function() {

0 commit comments

Comments
 (0)