@@ -3,14 +3,12 @@ import {
3
3
AfterViewInit ,
4
4
ApplicationRef ,
5
5
Component ,
6
- ComponentFactoryResolver ,
7
6
ComponentRef ,
8
7
Directive ,
9
8
ElementRef ,
10
9
Injector ,
11
10
QueryList ,
12
11
TemplateRef ,
13
- Type ,
14
12
ViewChild ,
15
13
ViewChildren ,
16
14
ViewContainerRef ,
@@ -38,12 +36,10 @@ describe('Portals', () => {
38
36
39
37
describe ( 'CdkPortalOutlet' , ( ) => {
40
38
let fixture : ComponentFixture < PortalTestApp > ;
41
- let componentFactoryResolver : ComponentFactoryResolver ;
42
39
43
40
beforeEach ( ( ) => {
44
41
fixture = TestBed . createComponent ( PortalTestApp ) ;
45
42
fixture . detectChanges ( ) ;
46
- componentFactoryResolver = TestBed . inject ( ComponentFactoryResolver ) ;
47
43
} ) ;
48
44
49
45
it ( 'should load a component into the portal' , ( ) => {
@@ -451,19 +447,6 @@ describe('Portals', () => {
451
447
expect ( instance . portalOutlet . hasAttached ( ) ) . toBe ( true ) ;
452
448
} ) ;
453
449
454
- it ( 'should use the `ComponentFactoryResolver` from the portal, if available' , ( ) => {
455
- const spy = jasmine . createSpy ( 'resolveComponentFactorySpy' ) ;
456
- const portal = new ComponentPortal ( PizzaMsg , undefined , undefined , {
457
- resolveComponentFactory : < T > ( ...args : [ Type < T > ] ) => {
458
- spy ( ) ;
459
- return componentFactoryResolver . resolveComponentFactory ( ...args ) ;
460
- } ,
461
- } ) ;
462
-
463
- fixture . componentInstance . portalOutlet . attachComponentPortal ( portal ) ;
464
- expect ( spy ) . toHaveBeenCalled ( ) ;
465
- } ) ;
466
-
467
450
it ( 'should render inside outlet when component portal specifies view container ref' , ( ) => {
468
451
const hostContainer = fixture . nativeElement . querySelector ( '.portal-container' ) ;
469
452
const portal = new ComponentPortal ( PizzaMsg , fixture . componentInstance . alternateContainer ) ;
@@ -491,7 +474,6 @@ describe('Portals', () => {
491
474
} ) ;
492
475
493
476
describe ( 'DomPortalOutlet' , ( ) => {
494
- let componentFactoryResolver : ComponentFactoryResolver ;
495
477
let someViewContainerRef : ViewContainerRef ;
496
478
let someInjector : Injector ;
497
479
let someFixture : ComponentFixture < ArbitraryViewContainerRefComponent > ;
@@ -501,18 +483,10 @@ describe('Portals', () => {
501
483
let appRef : ApplicationRef ;
502
484
503
485
beforeEach ( ( ) => {
504
- componentFactoryResolver = TestBed . inject ( ComponentFactoryResolver ) ;
505
486
injector = TestBed . inject ( Injector ) ;
506
487
appRef = TestBed . inject ( ApplicationRef ) ;
507
488
someDomElement = document . createElement ( 'div' ) ;
508
- host = new DomPortalOutlet (
509
- someDomElement ,
510
- componentFactoryResolver ,
511
- appRef ,
512
- injector ,
513
- document ,
514
- ) ;
515
-
489
+ host = new DomPortalOutlet ( someDomElement , null , appRef , injector , document ) ;
516
490
someFixture = TestBed . createComponent ( ArbitraryViewContainerRefComponent ) ;
517
491
someViewContainerRef = someFixture . componentInstance . viewContainerRef ;
518
492
someInjector = someFixture . componentInstance . injector ;
@@ -669,19 +643,6 @@ describe('Portals', () => {
669
643
expect ( spy ) . toHaveBeenCalled ( ) ;
670
644
} ) ;
671
645
672
- it ( 'should use the `ComponentFactoryResolver` from the portal, if available' , ( ) => {
673
- const spy = jasmine . createSpy ( 'resolveComponentFactorySpy' ) ;
674
- const portal = new ComponentPortal ( PizzaMsg , undefined , undefined , {
675
- resolveComponentFactory : < T > ( ...args : [ Type < T > ] ) => {
676
- spy ( ) ;
677
- return componentFactoryResolver . resolveComponentFactory ( ...args ) ;
678
- } ,
679
- } ) ;
680
-
681
- host . attachComponentPortal ( portal ) ;
682
- expect ( spy ) . toHaveBeenCalled ( ) ;
683
- } ) ;
684
-
685
646
it ( 'should attach and detach a DOM portal' , ( ) => {
686
647
const fixture = TestBed . createComponent ( PortalTestApp ) ;
687
648
fixture . detectChanges ( ) ;
0 commit comments