bug: events with dispatchEvent()
do not reach a parent's event handler that was added with addEventListener()
in a Spec Page
#5676
Labels
Bug: Validated
This PR or Issue is verified to be a bug within Stencil
Prerequisites
Stencil Version
4.16.0
Current Behavior
Note: this bug is for the test setup only (Spec Page).
When a Stencil component emits an event using
dispatchEvent()
, then a parent component can listen for that event usingaddEventListener()
. This works as expected in the browser. But, while running Spec tests, the event handler is not being called.(The
@Listen
and@Event
decorators are not being used here.)Expected Behavior
While running Spec tests (with
npm run test
), then I expect event handlers (added withaddEventListener()
) to be called when a child component emits an event (emitted withdispatchEvent()
).System Info
Steps to Reproduce
addEventListener()
in theconstructor
. Put aconsole.log
in the event handler.dispatchEvent()
in thecomponentDidLoad
lifecycle method.console.log
being called.Code Reproduction URL
https://github.com/tomherni/stencil-event-bug
Additional Information
I have everything set up, including the Spec file, in my reproduction repo.
The text was updated successfully, but these errors were encountered: