Skip to content

Commit

Permalink
Removed usage of the deprecated ComponentFactoryResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
devoto13 committed Mar 17, 2024
1 parent f1d9ce3 commit 97000bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/lib/icon/duotone-icon.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { faUser } from '@fortawesome/free-solid-svg-icons';
import { faDummy, initTest, queryByCss } from '../../testing/helpers';
import { FaDuotoneIconComponent } from './duotone-icon.component';
Expand Down Expand Up @@ -115,11 +115,8 @@ describe('FaDuotoneIconComponent', () => {
class HostComponent {
@ViewChild('host', { static: true, read: ViewContainerRef }) container: ViewContainerRef;

constructor(private cfr: ComponentFactoryResolver) {}

createIcon() {
const factory = this.cfr.resolveComponentFactory(FaDuotoneIconComponent);
const componentRef = this.container.createComponent(factory);
const componentRef = this.container.createComponent(FaDuotoneIconComponent);
componentRef.instance.icon = faDummy;
componentRef.instance.render();
}
Expand Down
7 changes: 2 additions & 5 deletions src/lib/icon/icon.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faUser as faUserRegular } from '@fortawesome/free-regular-svg-icons';
Expand Down Expand Up @@ -52,11 +52,8 @@ describe('FaIconComponent', () => {
class HostComponent {
@ViewChild('host', { static: true, read: ViewContainerRef }) container: ViewContainerRef;

constructor(private cfr: ComponentFactoryResolver) {}

createIcon() {
const factory = this.cfr.resolveComponentFactory(FaIconComponent);
const componentRef = this.container.createComponent(factory);
const componentRef = this.container.createComponent(FaIconComponent);
componentRef.instance.icon = faUser;
componentRef.instance.render();
}
Expand Down

0 comments on commit 97000bf

Please sign in to comment.