@angular/core 17.2.0-next.0 → 17.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/esm2022/primitives/signals/index.mjs +2 -2
  2. package/esm2022/src/application/application_init.mjs +2 -2
  3. package/esm2022/src/application/application_ref.mjs +2 -2
  4. package/esm2022/src/application/application_tokens.mjs +10 -9
  5. package/esm2022/src/authoring/input.mjs +1 -1
  6. package/esm2022/src/authoring/input_signal.mjs +4 -1
  7. package/esm2022/src/authoring/input_type_checking.mjs +1 -1
  8. package/esm2022/src/authoring/queries.mjs +8 -7
  9. package/esm2022/src/authoring.mjs +1 -1
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +51 -18
  11. package/esm2022/src/core_private_export.mjs +2 -2
  12. package/esm2022/src/defer/instructions.mjs +4 -2
  13. package/esm2022/src/di/forward_ref.mjs +1 -1
  14. package/esm2022/src/di/initializer_token.mjs +2 -2
  15. package/esm2022/src/di/injector.mjs +4 -4
  16. package/esm2022/src/di/injector_token.mjs +2 -2
  17. package/esm2022/src/di/internal_tokens.mjs +2 -2
  18. package/esm2022/src/di/scope.mjs +2 -2
  19. package/esm2022/src/hydration/error_handling.mjs +17 -6
  20. package/esm2022/src/hydration/utils.mjs +54 -8
  21. package/esm2022/src/i18n/tokens.mjs +5 -5
  22. package/esm2022/src/linker/compiler.mjs +2 -2
  23. package/esm2022/src/linker/query_list.mjs +7 -1
  24. package/esm2022/src/metadata/di.mjs +1 -1
  25. package/esm2022/src/platform/platform.mjs +2 -2
  26. package/esm2022/src/platform/platform_ref.mjs +2 -2
  27. package/esm2022/src/render3/component_ref.mjs +1 -1
  28. package/esm2022/src/render3/instructions/all.mjs +2 -1
  29. package/esm2022/src/render3/instructions/element.mjs +3 -3
  30. package/esm2022/src/render3/instructions/queries.mjs +6 -40
  31. package/esm2022/src/render3/instructions/queries_signals.mjs +55 -0
  32. package/esm2022/src/render3/instructions/write_to_directive_input.mjs +1 -1
  33. package/esm2022/src/render3/query.mjs +46 -7
  34. package/esm2022/src/render3/query_reactive.mjs +110 -0
  35. package/esm2022/src/render3/reactivity/computed.mjs +4 -1
  36. package/esm2022/src/render3/reactivity/signal.mjs +4 -1
  37. package/esm2022/src/util/ng_dev_mode.mjs +11 -3
  38. package/esm2022/src/version.mjs +1 -1
  39. package/esm2022/testing/src/component_fixture.mjs +128 -93
  40. package/esm2022/testing/src/logger.mjs +3 -3
  41. package/esm2022/testing/src/test_bed.mjs +11 -6
  42. package/esm2022/testing/src/test_bed_common.mjs +9 -2
  43. package/esm2022/testing/src/test_bed_compiler.mjs +5 -4
  44. package/esm2022/testing/src/testing.mjs +2 -2
  45. package/fesm2022/core.mjs +359 -100
  46. package/fesm2022/core.mjs.map +1 -1
  47. package/fesm2022/primitives/signals.mjs +2 -2
  48. package/fesm2022/rxjs-interop.mjs +1 -1
  49. package/fesm2022/testing.mjs +143 -96
  50. package/fesm2022/testing.mjs.map +1 -1
  51. package/index.d.ts +120 -21
  52. package/package.json +1 -1
  53. package/primitives/signals/index.d.ts +3 -1
  54. package/rxjs-interop/index.d.ts +1 -1
  55. package/schematics/migrations/block-template-entities/bundle.js +242 -207
  56. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  57. package/schematics/migrations/compiler-options/bundle.js +13 -13
  58. package/schematics/migrations/transfer-state/bundle.js +13 -13
  59. package/schematics/ng-generate/control-flow-migration/bundle.js +252 -217
  60. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  61. package/schematics/ng-generate/standalone-migration/bundle.js +1942 -1675
  62. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  63. package/testing/index.d.ts +6 -17
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -549,5 +549,5 @@ function setAlternateWeakRefImpl(impl) {
549
549
  // TODO: remove this function
550
550
  }
551
551
 
552
- export { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };
552
+ export { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };
553
553
  //# sourceMappingURL=signals.mjs.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,12 +1,13 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, InjectionToken, inject as inject$1, ɵNoopNgZone, NgZone, ɵEffectScheduler, ApplicationRef, getDebugNode, RendererFactory2, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵDeferBlockBehavior, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
7
+ import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, ɵDeferBlockBehavior, InjectionToken, inject as inject$1, ɵNoopNgZone, NgZone, ɵEffectScheduler, ApplicationRef, getDebugNode, RendererFactory2, ɵPendingTasks, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵChangeDetectionScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
8
8
  export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
9
- import { Subscription } from 'rxjs';
9
+ import { firstValueFrom, Subscription } from 'rxjs';
10
+ import { filter } from 'rxjs/operators';
10
11
  import { ResourceLoader } from '@angular/compiler';
11
12
 
12
13
  /**
@@ -137,6 +138,8 @@ const TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT = true;
137
138
  const THROW_ON_UNKNOWN_ELEMENTS_DEFAULT = false;
138
139
  /** Whether unknown properties in templates should throw by default. */
139
140
  const THROW_ON_UNKNOWN_PROPERTIES_DEFAULT = false;
141
+ /** Whether defer blocks should use manual triggering or play through normally. */
142
+ const DEFER_BLOCK_DEFAULT_BEHAVIOR = ɵDeferBlockBehavior.Playthrough;
140
143
  /**
141
144
  * An abstract class for inserting the root test component element in a platform independent way.
142
145
  *
@@ -150,6 +153,11 @@ class TestComponentRenderer {
150
153
  * @publicApi
151
154
  */
152
155
  const ComponentFixtureAutoDetect = new InjectionToken('ComponentFixtureAutoDetect');
156
+ /**
157
+ * TODO(atscott): Make public API once we have decided if we want this error and how we want devs to
158
+ * disable it.
159
+ */
160
+ const AllowDetectChangesAndAcknowledgeItCanHideApplicationBugs = new InjectionToken('AllowDetectChangesAndAcknowledgeItCanHideApplicationBugs');
153
161
  /**
154
162
  * @publicApi
155
163
  */
@@ -164,33 +172,131 @@ class ComponentFixture {
164
172
  /** @nodoc */
165
173
  constructor(componentRef) {
166
174
  this.componentRef = componentRef;
167
- this._isStable = true;
168
175
  this._isDestroyed = false;
169
- this._resolve = null;
170
- this._promise = null;
171
- this.noZoneOptionIsSet = inject$1(ComponentFixtureNoNgZone, { optional: true });
172
- this._ngZone = this.noZoneOptionIsSet ? new ɵNoopNgZone() : inject$1(NgZone);
173
- this._autoDetect = inject$1(ComponentFixtureAutoDetect, { optional: true }) ?? false;
174
- this.effectRunner = inject$1(ɵEffectScheduler);
175
- this._subscriptions = new Subscription();
176
+ /** @internal */
177
+ this._noZoneOptionIsSet = inject$1(ComponentFixtureNoNgZone, { optional: true });
178
+ /** @internal */
179
+ this._ngZone = this._noZoneOptionIsSet ? new ɵNoopNgZone() : inject$1(NgZone);
180
+ /** @internal */
181
+ this._effectRunner = inject$1(ɵEffectScheduler);
176
182
  // Inject ApplicationRef to ensure NgZone stableness causes after render hooks to run
177
183
  // This will likely happen as a result of fixture.detectChanges because it calls ngZone.run
178
184
  // This is a crazy way of doing things but hey, it's the world we live in.
179
185
  // The zoneless scheduler should instead do this more imperatively by attaching
180
186
  // the `ComponentRef` to `ApplicationRef` and calling `appRef.tick` as the `detectChanges`
181
187
  // behavior.
182
- this.appRef = inject$1(ApplicationRef);
188
+ /** @internal */
189
+ this._appRef = inject$1(ApplicationRef);
183
190
  // TODO(atscott): Remove this from public API
184
- this.ngZone = this.noZoneOptionIsSet ? null : this._ngZone;
191
+ this.ngZone = this._noZoneOptionIsSet ? null : this._ngZone;
185
192
  this.changeDetectorRef = componentRef.changeDetectorRef;
186
193
  this.elementRef = componentRef.location;
187
194
  this.debugElement = getDebugNode(this.elementRef.nativeElement);
188
195
  this.componentInstance = componentRef.instance;
189
196
  this.nativeElement = this.elementRef.nativeElement;
190
197
  this.componentRef = componentRef;
191
- this.setupNgZone();
192
198
  }
193
- setupNgZone() {
199
+ /**
200
+ * Do a change detection run to make sure there were no changes.
201
+ */
202
+ checkNoChanges() {
203
+ this.changeDetectorRef.checkNoChanges();
204
+ }
205
+ /**
206
+ * Retrieves all defer block fixtures in the component fixture.
207
+ *
208
+ * @developerPreview
209
+ */
210
+ getDeferBlocks() {
211
+ const deferBlocks = [];
212
+ const lView = this.componentRef.hostView['_lView'];
213
+ ɵgetDeferBlocks(lView, deferBlocks);
214
+ const deferBlockFixtures = [];
215
+ for (const block of deferBlocks) {
216
+ deferBlockFixtures.push(new DeferBlockFixture(block, this));
217
+ }
218
+ return Promise.resolve(deferBlockFixtures);
219
+ }
220
+ _getRenderer() {
221
+ if (this._renderer === undefined) {
222
+ this._renderer = this.componentRef.injector.get(RendererFactory2, null);
223
+ }
224
+ return this._renderer;
225
+ }
226
+ /**
227
+ * Get a promise that resolves when the ui state is stable following animations.
228
+ */
229
+ whenRenderingDone() {
230
+ const renderer = this._getRenderer();
231
+ if (renderer && renderer.whenRenderingDone) {
232
+ return renderer.whenRenderingDone();
233
+ }
234
+ return this.whenStable();
235
+ }
236
+ /**
237
+ * Trigger component destruction.
238
+ */
239
+ destroy() {
240
+ if (!this._isDestroyed) {
241
+ this.componentRef.destroy();
242
+ this._isDestroyed = true;
243
+ }
244
+ }
245
+ }
246
+ /**
247
+ * ComponentFixture behavior that actually attaches the component to the application to ensure
248
+ * behaviors between fixture and application do not diverge. `detectChanges` is disabled by default
249
+ * (instead, tests should wait for the scheduler to detect changes), `whenStable` is directly the
250
+ * `ApplicationRef.isStable`, and `autoDetectChanges` cannot be disabled.
251
+ */
252
+ class ScheduledComponentFixture extends ComponentFixture {
253
+ constructor() {
254
+ super(...arguments);
255
+ this.disableDetectChangesError = inject$1(AllowDetectChangesAndAcknowledgeItCanHideApplicationBugs, { optional: true }) ?? false;
256
+ this.pendingTasks = inject$1(ɵPendingTasks);
257
+ }
258
+ initialize() {
259
+ this._appRef.attachView(this.componentRef.hostView);
260
+ }
261
+ detectChanges(checkNoChanges = true) {
262
+ if (!this.disableDetectChangesError) {
263
+ throw new Error('Do not use `detectChanges` directly when using zoneless change detection.' +
264
+ ' Instead, wait for the next render or `fixture.whenStable`.');
265
+ }
266
+ else if (!checkNoChanges) {
267
+ throw new Error('Cannot disable `checkNoChanges` in this configuration. ' +
268
+ 'Use `fixture.componentRef.hostView.changeDetectorRef.detectChanges()` instead.');
269
+ }
270
+ this._effectRunner.flush();
271
+ this._appRef.tick();
272
+ this._effectRunner.flush();
273
+ }
274
+ isStable() {
275
+ return !this.pendingTasks.hasPendingTasks.value;
276
+ }
277
+ whenStable() {
278
+ if (this.isStable()) {
279
+ return Promise.resolve(false);
280
+ }
281
+ return firstValueFrom(this._appRef.isStable.pipe(filter(stable => stable)));
282
+ }
283
+ autoDetectChanges(autoDetect) {
284
+ throw new Error('Cannot call autoDetectChanges when using change detection scheduling.');
285
+ }
286
+ }
287
+ /**
288
+ * ComponentFixture behavior that attempts to act as a "mini application".
289
+ */
290
+ class PseudoApplicationComponentFixture extends ComponentFixture {
291
+ constructor() {
292
+ super(...arguments);
293
+ this._subscriptions = new Subscription();
294
+ this._autoDetect = inject$1(ComponentFixtureAutoDetect, { optional: true }) ?? false;
295
+ this._isStable = true;
296
+ this._promise = null;
297
+ this._resolve = null;
298
+ }
299
+ initialize() {
194
300
  // Create subscriptions outside the NgZone so that the callbacks run outside
195
301
  // of NgZone.
196
302
  this._ngZone.runOutsideAngular(() => {
@@ -235,57 +341,23 @@ class ComponentFixture {
235
341
  }));
236
342
  });
237
343
  }
238
- _tick(checkNoChanges) {
239
- this.changeDetectorRef.detectChanges();
240
- if (checkNoChanges) {
241
- this.checkNoChanges();
242
- }
243
- }
244
- /**
245
- * Trigger a change detection cycle for the component.
246
- */
247
344
  detectChanges(checkNoChanges = true) {
248
- this.effectRunner.flush();
345
+ this._effectRunner.flush();
249
346
  // Run the change detection inside the NgZone so that any async tasks as part of the change
250
347
  // detection are captured by the zone and can be waited for in isStable.
251
348
  this._ngZone.run(() => {
252
- this._tick(checkNoChanges);
349
+ this.changeDetectorRef.detectChanges();
350
+ if (checkNoChanges) {
351
+ this.checkNoChanges();
352
+ }
253
353
  });
254
354
  // Run any effects that were created/dirtied during change detection. Such effects might become
255
355
  // dirty in response to input signals changing.
256
- this.effectRunner.flush();
257
- }
258
- /**
259
- * Do a change detection run to make sure there were no changes.
260
- */
261
- checkNoChanges() {
262
- this.changeDetectorRef.checkNoChanges();
356
+ this._effectRunner.flush();
263
357
  }
264
- /**
265
- * Set whether the fixture should autodetect changes.
266
- *
267
- * Also runs detectChanges once so that any existing change is detected.
268
- */
269
- autoDetectChanges(autoDetect = true) {
270
- if (this.noZoneOptionIsSet) {
271
- throw new Error('Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set');
272
- }
273
- this._autoDetect = autoDetect;
274
- this.detectChanges();
275
- }
276
- /**
277
- * Return whether the fixture is currently stable or has async tasks that have not been completed
278
- * yet.
279
- */
280
358
  isStable() {
281
359
  return this._isStable && !this._ngZone.hasPendingMacrotasks;
282
360
  }
283
- /**
284
- * Get a promise that resolves when the fixture is stable.
285
- *
286
- * This can be used to resume testing after events have triggered asynchronous activity or
287
- * asynchronous change detection.
288
- */
289
361
  whenStable() {
290
362
  if (this.isStable()) {
291
363
  return Promise.resolve(false);
@@ -300,46 +372,16 @@ class ComponentFixture {
300
372
  return this._promise;
301
373
  }
302
374
  }
303
- /**
304
- * Retrieves all defer block fixtures in the component fixture.
305
- *
306
- * @developerPreview
307
- */
308
- getDeferBlocks() {
309
- const deferBlocks = [];
310
- const lView = this.componentRef.hostView['_lView'];
311
- ɵgetDeferBlocks(lView, deferBlocks);
312
- const deferBlockFixtures = [];
313
- for (const block of deferBlocks) {
314
- deferBlockFixtures.push(new DeferBlockFixture(block, this));
315
- }
316
- return Promise.resolve(deferBlockFixtures);
317
- }
318
- _getRenderer() {
319
- if (this._renderer === undefined) {
320
- this._renderer = this.componentRef.injector.get(RendererFactory2, null);
321
- }
322
- return this._renderer;
323
- }
324
- /**
325
- * Get a promise that resolves when the ui state is stable following animations.
326
- */
327
- whenRenderingDone() {
328
- const renderer = this._getRenderer();
329
- if (renderer && renderer.whenRenderingDone) {
330
- return renderer.whenRenderingDone();
375
+ autoDetectChanges(autoDetect = true) {
376
+ if (this._noZoneOptionIsSet) {
377
+ throw new Error('Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set.');
331
378
  }
332
- return this.whenStable();
379
+ this._autoDetect = autoDetect;
380
+ this.detectChanges();
333
381
  }
334
- /**
335
- * Trigger component destruction.
336
- */
337
382
  destroy() {
338
- if (!this._isDestroyed) {
339
- this.componentRef.destroy();
340
- this._subscriptions.unsubscribe();
341
- this._isDestroyed = true;
342
- }
383
+ this._subscriptions.unsubscribe();
384
+ super.destroy();
343
385
  }
344
386
  }
345
387
 
@@ -767,7 +809,7 @@ class TestBedCompiler {
767
809
  this.providerOverridesByToken = new Map();
768
810
  this.scopesWithOverriddenProviders = new Set();
769
811
  this.testModuleRef = null;
770
- this.deferBlockBehavior = ɵDeferBlockBehavior.Manual;
812
+ this.deferBlockBehavior = DEFER_BLOCK_DEFAULT_BEHAVIOR;
771
813
  class DynamicTestModule {
772
814
  }
773
815
  this.testModuleType = DynamicTestModule;
@@ -795,7 +837,7 @@ class TestBedCompiler {
795
837
  if (moduleDef.schemas !== undefined) {
796
838
  this.schemas.push(...moduleDef.schemas);
797
839
  }
798
- this.deferBlockBehavior = moduleDef.deferBlockBehavior ?? ɵDeferBlockBehavior.Manual;
840
+ this.deferBlockBehavior = moduleDef.deferBlockBehavior ?? DEFER_BLOCK_DEFAULT_BEHAVIOR;
799
841
  }
800
842
  overrideModule(ngModule, override) {
801
843
  if (ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT) {
@@ -1581,7 +1623,6 @@ class R3TestCompiler {
1581
1623
  }
1582
1624
 
1583
1625
  // The formatter and CI disagree on how this import statement should be formatted. Both try to keep
1584
- const DEFER_BLOCK_DEFAULT_BEHAVIOR = ɵDeferBlockBehavior.Playthrough;
1585
1626
  let _nextRootElementId = 0;
1586
1627
  /**
1587
1628
  * Returns a singleton of the `TestBed` class.
@@ -1906,7 +1947,13 @@ class TestBedImpl {
1906
1947
  const componentFactory = new ɵRender3ComponentFactory(componentDef);
1907
1948
  const initComponent = () => {
1908
1949
  const componentRef = componentFactory.create(Injector.NULL, [], `#${rootElId}`, this.testModuleRef);
1909
- return this.runInInjectionContext(() => new ComponentFixture(componentRef));
1950
+ return this.runInInjectionContext(() => {
1951
+ const hasScheduler = this.inject(ɵChangeDetectionScheduler, null) !== null;
1952
+ const fixture = hasScheduler ? new ScheduledComponentFixture(componentRef) :
1953
+ new PseudoApplicationComponentFixture(componentRef);
1954
+ fixture.initialize();
1955
+ return fixture;
1956
+ });
1910
1957
  };
1911
1958
  const noNgZone = this.inject(ComponentFixtureNoNgZone, false);
1912
1959
  const ngZone = noNgZone ? null : this.inject(NgZone, null);