@@ -11,10 +11,11 @@ import {By} from '@angular/platform-browser';
11
11
import { NgModule , Component , Directive , ViewChild , ViewContainerRef , Injector } from '@angular/core' ;
12
12
import { MdDialogModule } from './index' ;
13
13
import { MdDialog } from './dialog' ;
14
- import { OverlayContainer } from '../core' ;
14
+ import { OverlayContainer , ESCAPE } from '../core' ;
15
15
import { MdDialogRef } from './dialog-ref' ;
16
16
import { MdDialogContainer } from './dialog-container' ;
17
17
18
+ const FAKE_ESCAPE_KEY = { keyCode : ESCAPE } as KeyboardEvent ;
18
19
19
20
describe ( 'MdDialog' , ( ) => {
20
21
let dialog : MdDialog ;
@@ -128,7 +129,7 @@ describe('MdDialog', () => {
128
129
viewContainerFixture . debugElement . query ( By . directive ( MdDialogContainer ) ) . componentInstance ;
129
130
130
131
// Fake the user pressing the escape key by calling the handler directly.
131
- dialogContainer . _handleEscapeKey ( ) ;
132
+ dialogContainer . _handleKeydown ( FAKE_ESCAPE_KEY ) ;
132
133
viewContainerFixture . detectChanges ( ) ;
133
134
134
135
viewContainerFixture . whenStable ( ) . then ( ( ) => {
@@ -347,7 +348,7 @@ describe('MdDialog', () => {
347
348
By . directive ( MdDialogContainer ) ) . componentInstance ;
348
349
349
350
// Fake the user pressing the escape key by calling the handler directly.
350
- dialogContainer . _handleEscapeKey ( ) ;
351
+ dialogContainer . _handleKeydown ( FAKE_ESCAPE_KEY ) ;
351
352
352
353
expect ( overlayContainerElement . querySelector ( 'md-dialog-container' ) ) . toBeTruthy ( ) ;
353
354
} ) ;
0 commit comments