| 213 | }); |
| 214 | |
| 215 | @Component({ |
| 216 | template: '', |
| 217 | providers: [{provide: TOKEN, useValue: 'from component'}], |
| 218 | }) |
| 219 | class TestCmp { |
| 220 | envInjector = inject(EnvironmentInjector); |
| 221 | |
| 222 | tokenFromComponent = inject(TOKEN); |
| 223 | tokenFromEnvContext = this.envInjector.runInContext(() => inject(TOKEN)); |
| 224 | |
| 225 | // Attempt to inject ViewContainerRef within the environment injector's context. This should |
| 226 | // not be available, so the result should be `null`. |
| 227 | vcrFromEnvContext = this.envInjector.runInContext(() => |
| 228 | inject(ViewContainerRef, {optional: true}), |
| 229 | ); |
| 230 | } |
| 231 | |
| 232 | const instance = TestBed.createComponent(TestCmp).componentInstance; |
| 233 | expect(instance.tokenFromComponent).toEqual('from component'); |
nothing calls this directly
no test coverage detected
searching dependent graphs…