diff --git a/packages/core/test/render3/load_domino.ts b/packages/core/test/render3/load_domino.ts index e0d27309c6e..e85f09043d5 100644 --- a/packages/core/test/render3/load_domino.ts +++ b/packages/core/test/render3/load_domino.ts @@ -18,15 +18,10 @@ if (typeof window == 'undefined') { DominoAdapter.makeCurrent(); (global as any).document = getDOM().getDefaultDocument(); - // Trick to avoid Event patching from - // https://github.com/angular/angular/blob/7cf5e95ac9f0f2648beebf0d5bd9056b79946970/packages/platform-browser/src/dom/events/dom_events.ts#L112-L132 - // It fails with Domino with TypeError: Cannot assign to read only property - // 'stopImmediatePropagation' of object '#' - (global as any).Event = null; - // For animation tests, see // https://github.com/angular/angular/blob/main/packages/animations/browser/src/render/shared.ts#L140 (global as any).Element = domino.impl.Element; (global as any).isBrowser = false; (global as any).isNode = true; + (global as any).Event = domino.impl.Event; } diff --git a/packages/private/testing/src/utils.ts b/packages/private/testing/src/utils.ts index 09e7cc58d22..f33b3c7f3d6 100644 --- a/packages/private/testing/src/utils.ts +++ b/packages/private/testing/src/utils.ts @@ -130,7 +130,6 @@ async function loadDominoOrNull(): /** * Ensure that global has `Document` if we are in node.js - * @publicApi */ export async function ensureDocument(): Promise { if ((global as any).isBrowser) { @@ -147,11 +146,7 @@ export async function ensureDocument(): Promise { savedDocument = (global as any).document; (global as any).window = window; (global as any).document = window.document; - // Trick to avoid Event patching from - // https://github.com/angular/angular/blob/7cf5e95ac9f0f2648beebf0d5bd9056b79946970/packages/platform-browser/src/dom/events/dom_events.ts#L112-L132 - // It fails with Domino with TypeError: Cannot assign to read only property - // 'stopImmediatePropagation' of object '#' - (global as any).Event = null; + (global as any).Event = domino.impl.Event; savedNode = (global as any).Node; // Domino types do not type `impl`, but it's a documented field. // See: https://www.npmjs.com/package/domino#usage.