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

Fixup sort transform event data text using #1727

Merged
merged 2 commits into from
May 25, 2017

Conversation

etpinard
Copy link
Contributor

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:

  • 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

- 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) {
Copy link
Collaborator

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!');
Copy link
Contributor Author

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:

image

from fail_test.js

Copy link
Collaborator

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.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard etpinard merged commit 122ec6d into master May 25, 2017
@etpinard etpinard deleted the fixup-sort-transform-event-data-test branch May 25, 2017 17:59
@etpinard
Copy link
Contributor Author

cc @rreusser you might want to merge master into #1722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants