Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1672764

Browse files
fix: fallback to TestBed.get (testing-library#183)
1 parent 142f7cf commit 1672764

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎projects/testing-library/src/lib/testing-library.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { RenderComponentOptions, RenderDirectiveOptions, RenderResult } from './
2626
import { getConfig } from './config';
2727

2828
const mountedFixtures = new Set<ComponentFixture<any>>();
29+
const inject = TestBed.inject || TestBed.get;
2930

3031
export async function render<ComponentType>(
3132
component: Type<ComponentType>,
@@ -129,7 +130,6 @@ export async function render<SutType, WrapperType = SutType>(
129130
fixture.componentRef.injector.get(ChangeDetectorRef).detectChanges();
130131
};
131132

132-
const inject = TestBed.inject || TestBed.get;
133133
let router = routes ? inject(Router) : null;
134134
const zone = inject(NgZone);
135135
const navigate = async (elementOrPath: Element | string, basePath = '') => {
@@ -185,7 +185,7 @@ export async function render<SutType, WrapperType = SutType>(
185185

186186
async function createComponent<SutType>(component: Type<SutType>): Promise<ComponentFixture<SutType>> {
187187
/* Make sure angular application is initialized before creating component */
188-
await TestBed.inject(ApplicationInitStatus).donePromise;
188+
await inject(ApplicationInitStatus).donePromise;
189189
return TestBed.createComponent(component);
190190
}
191191

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /