fix(ivy): DebugElement.triggerEventHandler not picking up events registered via Renderer2 (#31845)

Fixes Ivy's `DebugElement.triggerEventHandler` to picking up events that have been registered through a `Renderer2`, unlike ViewEngine.

This PR resolves FW-1480.

PR Close #31845
This commit is contained in:
Kristiyan Kostadinov
2019-07-31 07:23:47 +03:00
committed by Alex Rickabaugh
parent a610d12266
commit 184d270725
5 changed files with 99 additions and 5 deletions

View File

@ -235,7 +235,13 @@ function wrapListener(
wrapWithPreventDefault: boolean): EventListener {
// Note: we are performing most of the work in the listener function itself
// to optimize listener registration.
return function wrapListenerIn_markDirtyAndPreventDefault(e: Event) {
return function wrapListenerIn_markDirtyAndPreventDefault(e: any) {
// Ivy uses `Function` as a special token that allows us to unwrap the function
// so that it can be invoked programmatically by `DebugNode.triggerEventHandler`.
if (e === Function) {
return listenerFn;
}
// In order to be backwards compatible with View Engine, events on component host nodes
// must also mark the component view itself dirty (i.e. the view that it owns).
const startView =