1
1
import { FocusMonitor , FocusOrigin } from '@angular/cdk/a11y' ;
2
- import { Directionality } from '@angular/cdk/bidi' ;
3
- import { A , ESCAPE } from '@angular/cdk/keycodes' ;
4
- import { Overlay , OverlayContainer , ScrollStrategy } from '@angular/cdk/overlay' ;
5
- import { ScrollDispatcher } from '@angular/cdk/scrolling' ;
6
2
import {
7
- createKeyboardEvent ,
8
- dispatchEvent ,
9
- dispatchKeyboardEvent ,
10
- dispatchMouseEvent ,
11
- patchElementFocus ,
12
- } from '@angular/cdk/testing/private' ;
13
- import { Location } from '@angular/common' ;
14
- import { SpyLocation } from '@angular/common /testing' ;
3
+ ComponentFixture ,
4
+ fakeAsync ,
5
+ flushMicrotasks ,
6
+ inject ,
7
+ TestBed ,
8
+ tick ,
9
+ flush ,
10
+ } from '@angular/core /testing' ;
15
11
import {
16
12
ChangeDetectionStrategy ,
17
13
Component ,
18
- ComponentFactoryResolver ,
19
14
Directive ,
20
15
Inject ,
21
16
Injector ,
@@ -26,15 +21,6 @@ import {
26
21
NgZone ,
27
22
ViewEncapsulation ,
28
23
} from '@angular/core' ;
29
- import {
30
- ComponentFixture ,
31
- fakeAsync ,
32
- flush ,
33
- flushMicrotasks ,
34
- inject ,
35
- TestBed ,
36
- tick ,
37
- } from '@angular/core/testing' ;
38
24
import { By } from '@angular/platform-browser' ;
39
25
import { BrowserAnimationsModule , NoopAnimationsModule } from '@angular/platform-browser/animations' ;
40
26
import { Location } from '@angular/common' ;
@@ -54,13 +40,12 @@ import {
54
40
} from '../../cdk/testing/private' ;
55
41
import {
56
42
MAT_DIALOG_DATA ,
57
- MAT_DIALOG_DEFAULT_OPTIONS ,
58
43
MatDialog ,
59
44
MatDialogModule ,
60
45
MatDialogRef ,
46
+ MAT_DIALOG_DEFAULT_OPTIONS ,
61
47
MatDialogState ,
62
48
} from './index' ;
63
-
64
49
import { Subject } from 'rxjs' ;
65
50
66
51
describe ( 'MatDialog' , ( ) => {
@@ -1396,8 +1381,7 @@ describe('MatDialog', () => {
1396
1381
button . focus ( ) ;
1397
1382
1398
1383
// Patch the element focus after the initial and real focus, because otherwise the
1399
- // `activeElement` won't be set, and the dialog won't be able to restore focus to an
1400
- // element.
1384
+ // `activeElement` won't be set, and the dialog won't be able to restore focus to an element.
1401
1385
patchElementFocus ( button ) ;
1402
1386
1403
1387
dialog . open ( PizzaMsg , { viewContainerRef : testViewContainerRef } ) ;
@@ -1430,8 +1414,7 @@ describe('MatDialog', () => {
1430
1414
button . focus ( ) ;
1431
1415
1432
1416
// Patch the element focus after the initial and real focus, because otherwise the
1433
- // `activeElement` won't be set, and the dialog won't be able to restore focus to an
1434
- // element.
1417
+ // `activeElement` won't be set, and the dialog won't be able to restore focus to an element.
1435
1418
patchElementFocus ( button ) ;
1436
1419
1437
1420
dialog . open ( PizzaMsg , { viewContainerRef : testViewContainerRef } ) ;
@@ -1640,10 +1623,9 @@ describe('MatDialog', () => {
1640
1623
'Expected the focus to change when dialog was opened.' ,
1641
1624
) ;
1642
1625
1626
+ // Start the closing sequence and move focus out of dialog.
1643
1627
dialogRef . close ( ) ;
1644
- flushMicrotasks ( ) ;
1645
- viewContainerFixture . detectChanges ( ) ;
1646
- tick ( 500 ) ;
1628
+ otherButton . focus ( ) ;
1647
1629
1648
1630
expect ( document . activeElement ! . id )
1649
1631
. withContext ( 'Expected focus to be on the alternate button.' )
@@ -1752,7 +1734,7 @@ describe('MatDialog', () => {
1752
1734
. toBe ( title . id ) ;
1753
1735
} ) ) ;
1754
1736
1755
- it ( 'should add align-* class according to given [align] input in [mat-dialog-actions]' , ( ) => {
1737
+ it ( 'should add mat-dialog-actions- align-* class according to given [align] input in [mat-dialog-actions]' , ( ) => {
1756
1738
let actions = overlayContainerElement . querySelector ( 'mat-dialog-actions' ) ! ;
1757
1739
1758
1740
expect ( actions )
0 commit comments