diff --git a/src/app/components/dialog/dialog.spec.ts b/src/app/components/dialog/dialog.spec.ts index 099d2af2da6..f55d375ba73 100755 --- a/src/app/components/dialog/dialog.spec.ts +++ b/src/app/components/dialog/dialog.spec.ts @@ -332,11 +332,7 @@ describe('Dialog', () => { fixture.detectChanges(); tick(300); - const escapeEvent: any = document.createEvent('CustomEvent'); - escapeEvent.which = 27; - escapeEvent.initEvent('keydown', true, true); - document.dispatchEvent(escapeEvent); - document.dispatchEvent(escapeEvent as KeyboardEvent); + document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })); fixture.detectChanges(); expect(closeSpy).toHaveBeenCalled();