-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix issue where styles weren't reset when re-using SVGs in colorbar #5217
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
Conversation
@anaplian to lock this issue, would you please add a test possibly to the end of this block?
To run the
Thanks! |
@archmoj Thanks! I have added a test. Let me know what you think 😄 |
test/jasmine/tests/colorbar_test.js
Outdated
|
||
var expectedAttrs = []; | ||
var actualAttrs = []; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test looks great.
Non-blocking, but maybe you could add a getter function to avoid duplication:
Something like:
function pushItemsTo(a) {
var colorbars = d3.select(gd).selectAll('.colorbar');
colorbars.selectAll('.cbfill').each(function() {
var attrsForElem = {};
for(var i = 0; i < this.attributes.length; i++) {
var attr = this.attributes.item(i);
attrsForElem[attr.name] = attr.value;
}
a.push(attrsForElem);
});
}
Plotly.newPlot(gd, [{type: 'contour', z: z}])
.then(function() {
pushItemsTo(expectedAttrs);
return Plotly.newPlot(gd, [{type: 'heatmap', z: z}])
.then(function() {
return Plotly.react(gd, [{type: 'contour', z: z}]);
});
})
.then(function() {
pushItemsTo(actualAttrs);
expect(actualAttrs).toEqual(expectedAttrs);
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 🙂
Nicely done! |
Fixes #5161