Custom events by ember-gestures are not working in testing using ember-test-helpers
See original GitHub issueI am writing a ember component ember-slider. I wrote some basic test cases for the component. But when I tried to write a test case triggering ‘tap’ event using ember-test-helpers, the event was not recognised by “ember-gestures” add-on which I am using capture user actions like tap and pan.
Following is the code I am using to test the tap functionality. Please help me figure out what is going wrong. I am not sure if I have provided enough detail here. Please let me know in case if more required.
test('tap to change value', async function(assert) {
assert.expect(2);
await render(hbs`{{ember-slider initialValue=10}}`);
assert.equal(parseInt(this.$('.slider-value')[0].textContent), 10, 'Value set to 10');
// The following jQuery event callback is called after tap('.ember-slider'); gets executed. But the tap event inside my component is not.
this.$('.ember-slider').on('click', function(e) {
console.log("Entered ", e);
});
await tap('.ember-slider');
assert.equal(parseInt(this.$('.slider-value')[0].textContent), 0, 'Value set back to 0 by tapping');
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Ember test with async await functions not working as intended
I am using ember-simple-auth with custom authenticator, which is pretty basic. Just sends login request to backend API, catching error when ...
Read more >ember-gestures - Bountysource
I'm using Ember-Cordova to build to Android and have noticed that on Android the panEnd event does not fire consistently. On iPhone it...
Read more >In an integration test, using the test helper `triggerKeyEvent ...
I was able to trigger it by using the native event dispatcher: const submitForm = async (element) => { const submitEvent = new ......
Read more >Awesome Ember.js
js data layer built with Orbit.js. ember-data-storefront - A collection of APIs that address common data-loading issues. ember-m3 - This addon provides an ......
Read more >@ember/test-helpers - npm
Helpers for testing Ember.js applications. Latest version: 2.9.3, last published: 3 days ago. Start using @ember/test-helpers in your ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, @rondale-sc and I spent some time poking at this this morning. Somewhat random brain dump follows…
tap
event. That fallback logic is here.PointerEvent
) but not on Chrome (supportsPointerEvent
).fireEvent
helper function is not aware ofPointerEvent
s, and fortouchstart
/touchend
events we fire the genericEvent
.Action items:
PointerEvent
whenwindow.PointerEvent
is present and fallback otherwiseapp.import
) along with a smoke test like the one written in the demo repo above to confirm tap continues to work with Hammer.js.@eriktrom I checked it with 1.0.0 version. The issue is still there. May be it is related to what @rwjblue mentioned.