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

Set key function for layout images #7277

Merged
merged 7 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/jasmine/tests/transition_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Plots.transition', function() {
var pythonLogo = 'https://images.plot.ly/language-icons/api-home/python-logo.png';

function imageel() {
return gd._fullLayout._imageUpperLayer.select('image').node();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wasn't able to replicate the transition error on real code so started poking around the test itself. I don't understand it, but somehow doing this d3 selection was resetting the data stored with the image element, causing the key function I added in this PR to think the existing element wasn't the right one to use for the new image, so line 135 below expect(e1).toBe(e2); failed. Switching to a native JS querySelector fixed it. 🤷

return gd._fullLayout._imageUpperLayer.node().querySelector('image');
}
function imagesrc() {
return imageel().getAttribute('href');
Expand Down