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

Example for using the Simulator #1

Open
sbradl opened this issue Sep 4, 2014 · 2 comments
Open

Example for using the Simulator #1

sbradl opened this issue Sep 4, 2014 · 2 comments

Comments

@sbradl
Copy link

sbradl commented Sep 4, 2014

For unit-testing parts of our web application I want to simulate touch events. Could you provide some examples for this? (I am using the HammerJS jQuery plugin and the Jasmine framework).

@jtangelder
Copy link
Member

Implementation can be found at the tests in Hammerjs

@sbradl
Copy link
Author

sbradl commented Sep 4, 2014

Thanks, I looked at the tests and managed to get something working.

Now I have the following problem:
I have a component which binds to the tap event. In the unit test I get the hammer instance by using "element.data('hammer')" and then bind my test function with "hammer.on('tap', ...)". Using "Simulator.gestures.tap(element)" I trigger the gesture. The problem now is that the gesture handler of the component is called after the gesture handler from the test.

Edit: when I use "element.hammer().bind('tap', ..)" instead of "hammer.on" the order is correct. So it seems like the order is different from raw hammerjs and the jquery version.

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

No branches or pull requests

2 participants