You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, none of the available DOM event helpers (triggerEvent, triggerKeyEvent, click, etc.) return the event which they have triggered on an element and instead return the value of the isSettled() call. This means that in cases where for example a component has prevented the browser's default action or has stopped the propagation of a certain event, this can't be tested by using the available DOM helpers of ember-test-helpers.
What is even the reason for returning the value of isSettled()? By looking at the code, it seems like the intention for this was to just chain the settled() promise in the returned event helper promise.
I've been previously using jQuery for having a dead simple API to trigger DOM events in tests, but since Ember is slowly getting rid of jQuery (which is a good thing), the logical choice for devs is to stop using jQuery in tests, too, and using the helper methods of ember-test-helpers instead. But since the test helpers don't return the events which they are triggering, this is a problem in certain test scenarios.
The text was updated successfully, but these errors were encountered:
@bastimeyer Right now every helper returns the value of calling settled(), which unless I'm wrong it is just a Promise<void>. What you are suggesting is that we change it so it returns Promise<Event>.
In ok with the idea in principle, as right now afaik we don't have any compromise of what the resolution value of the promises are. Changing from Promise<void> to Promise<Event> would give us more capabilities and wouldn't mess with existing code.
However it can be tricky for events like click or fillIn that in reality trigger several events.
Click, for instance, fires mousedown, focus, mouseup and then click.
We could just return click or return an object or array with all the fired events, but we'd have to decide what is the right thing to do first.
Currently, none of the available DOM event helpers (
triggerEvent
,triggerKeyEvent
,click
, etc.) return the event which they have triggered on an element and instead return the value of theisSettled()
call. This means that in cases where for example a component has prevented the browser's default action or has stopped the propagation of a certain event, this can't be tested by using the available DOM helpers of ember-test-helpers.What is even the reason for returning the value of
isSettled()
? By looking at the code, it seems like the intention for this was to just chain thesettled()
promise in the returned event helper promise.See this simple use case:
I've been previously using jQuery for having a dead simple API to trigger DOM events in tests, but since Ember is slowly getting rid of jQuery (which is a good thing), the logical choice for devs is to stop using jQuery in tests, too, and using the helper methods of ember-test-helpers instead. But since the test helpers don't return the events which they are triggering, this is a problem in certain test scenarios.
The text was updated successfully, but these errors were encountered: