|
1 | 1 | import {Directionality} from '../bidi';
|
2 | 2 | import {A, ESCAPE} from '../keycodes';
|
3 |
| -import {Overlay, OverlayContainer, ScrollDispatcher} from '../overlay'; |
| 3 | +import { |
| 4 | + createCloseScrollStrategy, |
| 5 | + createGlobalPositionStrategy, |
| 6 | + OverlayContainer, |
| 7 | + ScrollDispatcher, |
| 8 | +} from '../overlay'; |
4 | 9 | import {_supportsShadowDom} from '../platform';
|
5 | 10 | import {createKeyboardEvent, dispatchEvent, dispatchKeyboardEvent} from '../testing/private';
|
6 | 11 | import {Location} from '@angular/common';
|
@@ -37,7 +42,6 @@ describe('Dialog', () => {
|
37 | 42 | let testViewContainerRef: ViewContainerRef;
|
38 | 43 | let viewContainerFixture: ComponentFixture<ComponentWithChildViewContainer>;
|
39 | 44 | let mockLocation: SpyLocation;
|
40 |
| - let overlay: Overlay; |
41 | 45 | let scrolledSubject = new Subject();
|
42 | 46 |
|
43 | 47 | beforeEach(fakeAsync(() => {
|
@@ -66,7 +70,6 @@ describe('Dialog', () => {
|
66 | 70 |
|
67 | 71 | dialog = TestBed.inject(Dialog);
|
68 | 72 | mockLocation = TestBed.inject(Location) as SpyLocation;
|
69 |
| - overlay = TestBed.inject(Overlay); |
70 | 73 | overlayContainerElement = TestBed.inject(OverlayContainer).getContainerElement();
|
71 | 74 |
|
72 | 75 | viewContainerFixture = TestBed.createComponent(ComponentWithChildViewContainer);
|
@@ -452,7 +455,7 @@ describe('Dialog', () => {
|
452 | 455 |
|
453 | 456 | it('should be able to customize the position strategy', () => {
|
454 | 457 | dialog.open(PizzaMsg, {
|
455 |
| - positionStrategy: overlay.position().global().top('100px'), |
| 458 | + positionStrategy: createGlobalPositionStrategy(TestBed.inject(Injector)).top('100px'), |
456 | 459 | });
|
457 | 460 |
|
458 | 461 | viewContainerFixture.detectChanges();
|
@@ -555,12 +558,13 @@ describe('Dialog', () => {
|
555 | 558 |
|
556 | 559 | it('should close the dialog when detached externally', fakeAsync(() => {
|
557 | 560 | const closeSpy = jasmine.createSpy('closed');
|
| 561 | + const injector = TestBed.inject(Injector); |
558 | 562 | dialog
|
559 |
| - .open(PizzaMsg, {scrollStrategy: overlay.scrollStrategies.close()}) |
| 563 | + .open(PizzaMsg, {scrollStrategy: createCloseScrollStrategy(injector)}) |
560 | 564 | .closed.subscribe(closeSpy);
|
561 | 565 | viewContainerFixture.detectChanges();
|
562 | 566 | dialog
|
563 |
| - .open(PizzaMsg, {scrollStrategy: overlay.scrollStrategies.close()}) |
| 567 | + .open(PizzaMsg, {scrollStrategy: createCloseScrollStrategy(injector)}) |
564 | 568 | .closed.subscribe(closeSpy);
|
565 | 569 | viewContainerFixture.detectChanges();
|
566 | 570 |
|
|
0 commit comments