Skip to content

Commit

Permalink
use static overrideTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJW34 committed Aug 29, 2022
1 parent d7f4cfe commit d6cdd3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion npm/angular/src/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ComponentFixture,
getTestBed,
TestModuleMetadata,
TestBed,
} from '@angular/core/testing'
import {
BrowserDynamicTestingModule,
Expand Down Expand Up @@ -171,7 +172,9 @@ function createComponentFixture<T> (
component: Type<T> | string,
): Type<T | WrapperComponent> {
if (typeof component === 'string') {
getTestBed().overrideTemplate(WrapperComponent, component)
// getTestBed().overrideTemplate is available in v14+
// The static TestBed.overrideTemplate is available across versions
TestBed.overrideTemplate(WrapperComponent, component)

return WrapperComponent
}
Expand Down

0 comments on commit d6cdd3b

Please sign in to comment.