-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixup sort transform event data text using #1727
Conversation
- hover and click when invoked programmatically back-to-back don't behave well. - this test case makes assertions on the event data (i.e. gd._hoverdata) which is the same for hover and click - use `delete gd._lastHoverTime` to 🔪 that annoying wait promise
@@ -275,6 +275,7 @@ describe('Test sort transform interactions:', function() { | |||
function hover(gd, id) { | |||
return new Promise(function(resolve) { | |||
gd.once('plotly_hover', function(eventData) { |
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.
Ah, this pattern is probably the reason we're timing out blind - when we wait for an event to resolve our promise, we need some timeout that causes an explicit error if that event never fires (and gets aborted when the event does fire), so we can see what's happening.
delete gd._lastHoverTime
may well solve the issue here, but in case it doesn't (or something else crops up when we alter/extend this later) can you add that?
gd.once('plotly_hover', function(eventData) { | ||
delete gd._lastHoverTime; | ||
resolve(eventData); | ||
}); | ||
|
||
var pos = getPxPos(gd, id); | ||
mouseEvent('mousemove', pos[0], pos[1]); | ||
|
||
setTimeout(function() { | ||
reject('plotly_hover did not get called!'); |
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.
@alexcjohnson something like this?
e.g. if we comment out the above mouseEvent()
we get:
from fail_test.js
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.
yeah, that's great! Right, and you don't even need to cancel the timeout because after resolve is called, reject doesn't do anything... nice!
In principle to tell precisely what's going on we probably need a message - but that can be added during debugging if we get to that point.
💃 |
This test doesn't behave well on CI as noticed by @alexcjohnson and @rreusser
So to remedy this problem, we'll test sort transform event data using hover events only:
gd._hoverdata
) which is the same for hover and clickdelete gd._lastHoverTime
to 🔪 that annoying wait promise