Skip to content

Commit 91a4353

Browse files
committed
Removed usage of the deprecated ComponentFactoryResolver
1 parent f1d9ce3 commit 91a4353

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/lib/icon/duotone-icon.component.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
1+
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
22
import { faUser } from '@fortawesome/free-solid-svg-icons';
33
import { faDummy, initTest, queryByCss } from '../../testing/helpers';
44
import { FaDuotoneIconComponent } from './duotone-icon.component';
@@ -115,11 +115,8 @@ describe('FaDuotoneIconComponent', () => {
115115
class HostComponent {
116116
@ViewChild('host', { static: true, read: ViewContainerRef }) container: ViewContainerRef;
117117

118-
constructor(private cfr: ComponentFactoryResolver) {}
119-
120118
createIcon() {
121-
const factory = this.cfr.resolveComponentFactory(FaDuotoneIconComponent);
122-
const componentRef = this.container.createComponent(factory);
119+
const componentRef = this.container.createComponent(FaDuotoneIconComponent);
123120
componentRef.instance.icon = faDummy;
124121
componentRef.instance.render();
125122
}

src/lib/icon/icon.component.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
1+
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
22
import { TestBed } from '@angular/core/testing';
33
import { IconProp } from '@fortawesome/fontawesome-svg-core';
44
import { faUser as faUserRegular } from '@fortawesome/free-regular-svg-icons';
@@ -52,11 +52,8 @@ describe('FaIconComponent', () => {
5252
class HostComponent {
5353
@ViewChild('host', { static: true, read: ViewContainerRef }) container: ViewContainerRef;
5454

55-
constructor(private cfr: ComponentFactoryResolver) {}
56-
5755
createIcon() {
58-
const factory = this.cfr.resolveComponentFactory(FaIconComponent);
59-
const componentRef = this.container.createComponent(factory);
56+
const componentRef = this.container.createComponent(FaIconComponent);
6057
componentRef.instance.icon = faUser;
6158
componentRef.instance.render();
6259
}

0 commit comments

Comments
 (0)