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

Test click event handlers #176

Merged
merged 2 commits into from
Jan 12, 2016
Merged

Test click event handlers #176

merged 2 commits into from
Jan 12, 2016

Conversation

etpinard
Copy link
Contributor

@mdtusz @alexcjohnson @cldougl

so that #173 never happens again.

Useful resource: https://developer.mozilla.org/en/docs/Web/API/MouseEvent

The test below would have failed before the patch in #174

- use mouse event asset to simulation an svg2d click event
- plotly_click is a combinaison of a mousemove, mousedown and mouseup
  mouse events
- use that to inspect click event data
function click() {
mouseEvent('mousemove', clientX, clientY);
mouseEvent('mousedown', clientX, clientY);
mouseEvent('mouseup', clientX, clientY);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mdtusz @cldougl

cartesian click events use the hover data from the mousemove event and then simulate a click event on mouseup here.

So to test plotly_click we need to fire three events at the same client (x,y) location.

@mdtusz
Copy link
Contributor

mdtusz commented Jan 12, 2016

Good stuff 👍. It's still surprising to me that no frontend test frameworks include a mouse event simulator (to my knowledge). I suppose it could promote overuse and bad testing, but it's such a useful tool!

etpinard added a commit that referenced this pull request Jan 12, 2016
@etpinard etpinard merged commit 6eb479d into master Jan 12, 2016
@etpinard etpinard deleted the click-event-test branch January 12, 2016 17:12
@etpinard etpinard mentioned this pull request Feb 16, 2016
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