Skip to content

Commit c87c4aa

Browse files
committed
Revert weird changes to dialog.spec.ts
1 parent d6deb45 commit c87c4aa

File tree

2 files changed

+15
-34
lines changed

2 files changed

+15
-34
lines changed

src/material-experimental/mdc-dialog/dialog.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {By} from '@angular/platform-browser';
3939
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
4040
import {numbers} from '@material/dialog';
4141
import {Subject} from 'rxjs';
42-
4342
import {
4443
MatDialog,
4544
MatDialogModule,
@@ -1672,7 +1671,7 @@ describe('MDC-based MatDialog', () => {
16721671
.toBe(title.id);
16731672
}));
16741673

1675-
it('should add align-* class according to given [align] input in [mat-dialog-actions]', () => {
1674+
it('should add mat-mdc-dialog-actions-align-* class according to given [align] input in [mat-dialog-actions]', () => {
16761675
let actions = overlayContainerElement.querySelector('mat-dialog-actions')!;
16771676

16781677
expect(actions)

src/material/dialog/dialog.spec.ts

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
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';
62
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';
1511
import {
1612
ChangeDetectionStrategy,
1713
Component,
18-
ComponentFactoryResolver,
1914
Directive,
2015
Inject,
2116
Injector,
@@ -26,15 +21,6 @@ import {
2621
NgZone,
2722
ViewEncapsulation,
2823
} from '@angular/core';
29-
import {
30-
ComponentFixture,
31-
fakeAsync,
32-
flush,
33-
flushMicrotasks,
34-
inject,
35-
TestBed,
36-
tick,
37-
} from '@angular/core/testing';
3824
import {By} from '@angular/platform-browser';
3925
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
4026
import {Location} from '@angular/common';
@@ -54,13 +40,12 @@ import {
5440
} from '../../cdk/testing/private';
5541
import {
5642
MAT_DIALOG_DATA,
57-
MAT_DIALOG_DEFAULT_OPTIONS,
5843
MatDialog,
5944
MatDialogModule,
6045
MatDialogRef,
46+
MAT_DIALOG_DEFAULT_OPTIONS,
6147
MatDialogState,
6248
} from './index';
63-
6449
import {Subject} from 'rxjs';
6550

6651
describe('MatDialog', () => {
@@ -1396,8 +1381,7 @@ describe('MatDialog', () => {
13961381
button.focus();
13971382

13981383
// 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.
14011385
patchElementFocus(button);
14021386

14031387
dialog.open(PizzaMsg, {viewContainerRef: testViewContainerRef});
@@ -1430,8 +1414,7 @@ describe('MatDialog', () => {
14301414
button.focus();
14311415

14321416
// 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.
14351418
patchElementFocus(button);
14361419

14371420
dialog.open(PizzaMsg, {viewContainerRef: testViewContainerRef});
@@ -1640,10 +1623,9 @@ describe('MatDialog', () => {
16401623
'Expected the focus to change when dialog was opened.',
16411624
);
16421625

1626+
// Start the closing sequence and move focus out of dialog.
16431627
dialogRef.close();
1644-
flushMicrotasks();
1645-
viewContainerFixture.detectChanges();
1646-
tick(500);
1628+
otherButton.focus();
16471629

16481630
expect(document.activeElement!.id)
16491631
.withContext('Expected focus to be on the alternate button.')
@@ -1752,7 +1734,7 @@ describe('MatDialog', () => {
17521734
.toBe(title.id);
17531735
}));
17541736

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]', () => {
17561738
let actions = overlayContainerElement.querySelector('mat-dialog-actions')!;
17571739

17581740
expect(actions)

0 commit comments

Comments
 (0)