-
Notifications
You must be signed in to change notification settings - Fork 14
Mocking target
for sendEvent()
#12
Comments
This is a real challenge for IE11. Whenever an event is dispatched, it overwrites the target, even if the mocked There are two solutions:
I prefer the latter, mostly because I see it being somewhat of a problem only sending the event in one special way on one special platform, and while it is feasible to keep the map due to the @Ant @matt-gadd @bitpshr thoughts? |
So any test that uses a mocked event target would need to be explicitly skipped on IE11? I worry a bit about imposing this behavior on consumers, but the idea of having to potentially ascend the |
Yes, but hopefully those would be in the minority. In most cases it is best to observe the behaviour on the target after the listener has fired. I think we need to understand better the use cases where it feels valid to mock the target. There are two big challenges right now where widgets have to touch the DOM (and then really care about the contents of DOM events). Those are animations and focus management. We need to abstract widgets away from those so these sorts of things aren't problematic. |
@kitsonk is there anyway you could "wrap" the handlers with a harness function and then inject the mock event at the point of execution? (throwing away the event that is provided from the actual action) |
Retiring this in lieu of #23. We can re-open later on if the need is there. |
Enhancement
We should make sure that for
sendEvent()
that even though thetarget
is always a real DOM node, that it might be necessary to mock theevent.target
that gets dispatched. Therefore we should ensure that it can be passed (and be present) via theeventInit
for thesendEvent()
arguments so that the following would work in all environments:The text was updated successfully, but these errors were encountered: