Skip to content

Commit

Permalink
revised in respect to 1st review
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Jan 9, 2019
1 parent f2c4791 commit 168bb68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/plot_api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ exports.cleanData = function(data) {
}

// scl->scale, reversescl->reversescale
if('scl' in trace) {
if(!('colorscale' in trace)) { trace.colorscale = trace.scl; }
if('scl' in trace && !('colorscale' in trace)) {
trace.colorscale = trace.scl;
delete trace.scl;
}
if('reversescl' in trace) {
if(!('reversescale' in trace)) { trace.reversescale = trace.reversescl; }
if('reversescl' in trace && !('reversescale' in trace)) {
trace.reversescale = trace.reversescl;
delete trace.reversescl;
}

Expand Down
8 changes: 4 additions & 4 deletions test/jasmine/tests/plot_api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ describe('Test plot api', function() {
expect(gd.data[0].scl).toBe(undefined);
});

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

Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('Greens');
expect(gd.data[0].scl).toBe(undefined);
expect(gd.data[0].scl).not.toBe(undefined);
});

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

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

Plotly.plot(gd, data);
expect(gd.data[0].reversescale).toBe(true);
expect(gd.data[0].reversescl).toBe(undefined);
expect(gd.data[0].reversescl).not.toBe(undefined);
});

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

0 comments on commit 168bb68

Please sign in to comment.