Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming old attributes should not replace existing current attributes if both provided #3423

Merged
merged 2 commits into from
Jan 9, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jan 8, 2019

Fix #3419
@plotly/plotly_js

@@ -319,11 +319,11 @@ exports.cleanData = function(data) {

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be just one if-statement?

if('scl' in trace && !('colorscale' in trace)) {
  // ...
}

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be namely if we want to leave scl on the input trace in that scenario.


Plotly.plot(gd, data);
expect(gd.data[0].colorscale).toBe('Greens');
expect(gd.data[0].scl).toBe(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.... this here would be 'Reds', but that's not a big deal, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes now that the logic changed it should not be undefined.
Done in 168bb68

expect(gd.data[0].reversescl).toBe(undefined);
});

it('should not rename \'scl\' to \'colorscale\' when colorscale is defined ', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong description it looks like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👁️ Thanks.

@etpinard
Copy link
Contributor

etpinard commented Jan 9, 2019

💃 - thanks for fixing 4+ year-old deprecation logic 😄

@archmoj archmoj merged commit 2d205e7 into master Jan 9, 2019
@archmoj archmoj deleted the fix3419-rename-colorscale branch January 9, 2019 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants