@angular/core 20.0.0-rc.0 → 20.0.0-rc.2
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.
- package/{api.d-CRxC7NlU.d.ts → api.d-B0vztftH.d.ts} +15 -15
- package/{chrome_dev_tools_performance.d-B0FzTuRf.d.ts → chrome_dev_tools_performance.d-DvzAxqBc.d.ts} +9 -29
- package/{discovery.d-CBxzK1ay.d.ts → discovery.d-Cf_r2Ojk.d.ts} +7 -13
- package/{event_dispatcher.d-DlbccpYq.d.ts → event_dispatcher.d-BReQpZfC.d.ts} +27 -1
- package/fesm2022/attribute-BWp59EjE.mjs +1 -1
- package/fesm2022/attribute-BWp59EjE.mjs.map +1 -1
- package/fesm2022/core.mjs +21 -14
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{debug_node-3mmnD06K.mjs → debug_node-Nc-zr65s.mjs} +11161 -11262
- package/fesm2022/debug_node-Nc-zr65s.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +3 -2
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/{resource-nrAenwIA.mjs → resource-DOwetGLU.mjs} +64 -14
- package/fesm2022/resource-DOwetGLU.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler-B_EWGyLU.mjs → root_effect_scheduler-BgGHQ80j.mjs} +29 -17
- package/fesm2022/root_effect_scheduler-BgGHQ80j.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +27 -12
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal-ePSl6jXn.mjs +1 -1
- package/fesm2022/signal-ePSl6jXn.mjs.map +1 -1
- package/fesm2022/testing.mjs +86 -77
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-2ouAFbCz.mjs +1 -1
- package/fesm2022/untracked-2ouAFbCz.mjs.map +1 -1
- package/fesm2022/weak_ref-BaIq-pgY.mjs +1 -1
- package/fesm2022/weak_ref-BaIq-pgY.mjs.map +1 -1
- package/graph.d-BcIOep_B.d.ts +1 -1
- package/index.d.ts +205 -325
- package/package.json +3 -3
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +4 -4
- package/schematics/bundles/{apply_import_manager-Coc7Hewu.js → apply_import_manager-BqwxKJiu.cjs} +3 -3
- package/schematics/bundles/{change_tracker-CDJPOAni.js → change_tracker-B1qegJFu.cjs} +3 -3
- package/schematics/bundles/{checker-BAl7CJ0l.js → checker-DmucNdBi.cjs} +55 -45
- package/schematics/bundles/{cleanup-unused-imports.js → cleanup-unused-imports.cjs} +30 -62
- package/schematics/bundles/{compiler-BSv6JWRF.js → compiler-DPq1iS19.cjs} +142 -95
- package/schematics/bundles/{compiler_host-CAfDJO3W.js → compiler_host-CAfDJO3W.cjs} +1 -1
- package/schematics/bundles/{control-flow-migration.js → control-flow-migration.cjs} +4 -4
- package/schematics/bundles/{document-core.js → document-core.cjs} +9 -9
- package/schematics/bundles/{imports-CIX-JgAN.js → imports-CIX-JgAN.cjs} +1 -1
- package/schematics/bundles/{index-CxuDmkeg.js → index-1H-qYSW6.cjs} +101 -37
- package/schematics/bundles/{index-CnKffIJ6.js → index-CFmTQ_wx.cjs} +29 -20
- package/schematics/bundles/{inject-flags.js → inject-flags.cjs} +9 -9
- package/schematics/bundles/{inject-migration.js → inject-migration.cjs} +9 -9
- package/schematics/bundles/{leading_space-D9nQ8UQC.js → leading_space-D9nQ8UQC.cjs} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DE1AlxIs.js → migrate_ts_type_references-B2aJNuIK.cjs} +7 -7
- package/schematics/bundles/{ng_decorators-DznZ5jMl.js → ng_decorators-B5HCqr20.cjs} +2 -2
- package/schematics/bundles/{nodes-B16H9JUd.js → nodes-B16H9JUd.cjs} +1 -1
- package/schematics/bundles/{output-migration.js → output-migration.cjs} +14 -17
- package/schematics/bundles/{project_paths-Bl-H7Vlb.js → project_paths-DmvzlTQL.cjs} +71 -42
- package/schematics/bundles/{project_tsconfig_paths-CDVxT6Ov.js → project_tsconfig_paths-CDVxT6Ov.cjs} +1 -1
- package/schematics/bundles/{property_name-BBwFuqMe.js → property_name-BBwFuqMe.cjs} +1 -1
- package/schematics/bundles/{route-lazy-loading.js → route-lazy-loading.cjs} +7 -7
- package/schematics/bundles/{self-closing-tags-migration.js → self-closing-tags-migration.cjs} +17 -34
- package/schematics/bundles/{signal-input-migration.js → signal-input-migration.cjs} +28 -27
- package/schematics/bundles/{signal-queries-migration.js → signal-queries-migration.cjs} +18 -21
- package/schematics/bundles/{signals.js → signals.cjs} +13 -13
- package/schematics/bundles/{standalone-migration.js → standalone-migration.cjs} +11 -11
- package/schematics/bundles/{symbol-VPWguRxr.js → symbol-VPWguRxr.cjs} +1 -1
- package/schematics/bundles/{test-bed-get.js → test-bed-get.cjs} +9 -9
- package/schematics/collection.json +9 -9
- package/schematics/migrations.json +4 -4
- package/signal.d-D6VJ67xi.d.ts +1 -1
- package/testing/index.d.ts +21 -7
- package/weak_ref.d-eGOEP9S1.d.ts +1 -1
- package/fesm2022/debug_node-3mmnD06K.mjs.map +0 -1
- package/fesm2022/resource-nrAenwIA.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler-B_EWGyLU.mjs.map +0 -1
- package/schematics/package.json +0 -3
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-rc.
|
|
2
|
+
* @license Angular v20.0.0-rc.2
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { CONTAINER_HEADER_OFFSET, InjectionToken, inject as inject$1, EnvironmentInjector, ErrorHandler, PendingTasksInternal, ZONELESS_ENABLED, ChangeDetectionScheduler, EffectScheduler, stringify, getInjectableDef, resolveForwardRef, NG_COMP_DEF, NG_DIR_DEF, NG_PIPE_DEF, NG_INJ_DEF, NG_MOD_DEF, ENVIRONMENT_INITIALIZER, INTERNAL_APPLICATION_ERROR_HANDLER, Injector, isEnvironmentProviders, runInInjectionContext } from './root_effect_scheduler-B_EWGyLU.mjs';
|
|
8
7
|
import { Subscription } from 'rxjs';
|
|
9
|
-
import {
|
|
8
|
+
import { inject as inject$1, EnvironmentInjector, ErrorHandler, CONTAINER_HEADER_OFFSET, InjectionToken, PendingTasksInternal, ZONELESS_ENABLED, ChangeDetectionScheduler, EffectScheduler, stringify, getInjectableDef, resolveForwardRef, NG_COMP_DEF, NG_DIR_DEF, NG_PIPE_DEF, NG_INJ_DEF, NG_MOD_DEF, ENVIRONMENT_INITIALIZER, INTERNAL_APPLICATION_ERROR_HANDLER, Injector, isEnvironmentProviders, runInInjectionContext } from './root_effect_scheduler-BgGHQ80j.mjs';
|
|
10
9
|
import * as i0 from '@angular/core';
|
|
10
|
+
import { NgZone, Injectable, DeferBlockState, triggerResourceLoading, renderDeferBlockState, getDeferBlocks, DeferBlockBehavior, NoopNgZone, ApplicationRef, getDebugNode, RendererFactory2, Pipe, Directive, Component, NgModule, ReflectionCapabilities, depsTracker, isComponentDefPendingResolution, getAsyncClassMetadataFn, resolveComponentResources, NgModuleRef, ApplicationInitStatus, LOCALE_ID, DEFAULT_LOCALE_ID, setLocaleId, ComponentFactory, compileComponent, compileDirective, compilePipe, patchComponentDefWithScope, compileNgModuleDefs, clearResolutionOfComponentResourcesQueue, restoreComponentResolutionQueue, internalProvideZoneChangeDetection, ChangeDetectionSchedulerImpl, Compiler, DEFER_BLOCK_CONFIG, COMPILER_OPTIONS, transitiveScopesFor, generateStandaloneInDeclarationsError, NgModuleFactory, ModuleWithComponentFactories, resetCompiledComponents, ɵsetUnknownElementStrictMode as _setUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode as _setUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode as _getUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode as _getUnknownPropertyStrictMode, flushModuleScopingQueueAsMuchAsPossible, setAllowDuplicateNgModuleIdsForTest } from './debug_node-Nc-zr65s.mjs';
|
|
11
11
|
import { ResourceLoader } from '@angular/compiler';
|
|
12
12
|
import './primitives/di.mjs';
|
|
13
13
|
import './signal-ePSl6jXn.mjs';
|
|
@@ -51,6 +51,42 @@ function waitForAsync(fn) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
const RETHROW_APPLICATION_ERRORS_DEFAULT = true;
|
|
55
|
+
class TestBedApplicationErrorHandler {
|
|
56
|
+
zone = inject$1(NgZone);
|
|
57
|
+
injector = inject$1(EnvironmentInjector);
|
|
58
|
+
userErrorHandler;
|
|
59
|
+
whenStableRejectFunctions = new Set();
|
|
60
|
+
handleError(e) {
|
|
61
|
+
try {
|
|
62
|
+
this.zone.runOutsideAngular(() => {
|
|
63
|
+
this.userErrorHandler ??= this.injector.get(ErrorHandler);
|
|
64
|
+
this.userErrorHandler.handleError(e);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (userError) {
|
|
68
|
+
e = userError;
|
|
69
|
+
}
|
|
70
|
+
// Instead of throwing the error when there are outstanding `fixture.whenStable` promises,
|
|
71
|
+
// reject those promises with the error. This allows developers to write
|
|
72
|
+
// expectAsync(fix.whenStable()).toBeRejected();
|
|
73
|
+
if (this.whenStableRejectFunctions.size > 0) {
|
|
74
|
+
for (const fn of this.whenStableRejectFunctions.values()) {
|
|
75
|
+
fn(e);
|
|
76
|
+
}
|
|
77
|
+
this.whenStableRejectFunctions.clear();
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static ɵfac = function TestBedApplicationErrorHandler_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TestBedApplicationErrorHandler)(); };
|
|
84
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TestBedApplicationErrorHandler, factory: TestBedApplicationErrorHandler.ɵfac });
|
|
85
|
+
}
|
|
86
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TestBedApplicationErrorHandler, [{
|
|
87
|
+
type: Injectable
|
|
88
|
+
}], null, null); })();
|
|
89
|
+
|
|
54
90
|
/**
|
|
55
91
|
* Represents an individual defer block for testing purposes.
|
|
56
92
|
*
|
|
@@ -59,7 +95,7 @@ function waitForAsync(fn) {
|
|
|
59
95
|
class DeferBlockFixture {
|
|
60
96
|
block;
|
|
61
97
|
componentFixture;
|
|
62
|
-
/** @
|
|
98
|
+
/** @docs-private */
|
|
63
99
|
constructor(block, componentFixture) {
|
|
64
100
|
this.block = block;
|
|
65
101
|
this.componentFixture = componentFixture;
|
|
@@ -156,42 +192,6 @@ const ComponentFixtureAutoDetect = new InjectionToken('ComponentFixtureAutoDetec
|
|
|
156
192
|
*/
|
|
157
193
|
const ComponentFixtureNoNgZone = new InjectionToken('ComponentFixtureNoNgZone');
|
|
158
194
|
|
|
159
|
-
const RETHROW_APPLICATION_ERRORS_DEFAULT = true;
|
|
160
|
-
class TestBedApplicationErrorHandler {
|
|
161
|
-
zone = inject$1(NgZone);
|
|
162
|
-
injector = inject$1(EnvironmentInjector);
|
|
163
|
-
userErrorHandler;
|
|
164
|
-
whenStableRejectFunctions = new Set();
|
|
165
|
-
handleError(e) {
|
|
166
|
-
try {
|
|
167
|
-
this.zone.runOutsideAngular(() => {
|
|
168
|
-
this.userErrorHandler ??= this.injector.get(ErrorHandler);
|
|
169
|
-
this.userErrorHandler.handleError(e);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
catch (userError) {
|
|
173
|
-
e = userError;
|
|
174
|
-
}
|
|
175
|
-
// Instead of throwing the error when there are outstanding `fixture.whenStable` promises,
|
|
176
|
-
// reject those promises with the error. This allows developers to write
|
|
177
|
-
// expectAsync(fix.whenStable()).toBeRejected();
|
|
178
|
-
if (this.whenStableRejectFunctions.size > 0) {
|
|
179
|
-
for (const fn of this.whenStableRejectFunctions.values()) {
|
|
180
|
-
fn(e);
|
|
181
|
-
}
|
|
182
|
-
this.whenStableRejectFunctions.clear();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
throw e;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
static ɵfac = function TestBedApplicationErrorHandler_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TestBedApplicationErrorHandler)(); };
|
|
189
|
-
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TestBedApplicationErrorHandler, factory: TestBedApplicationErrorHandler.ɵfac });
|
|
190
|
-
}
|
|
191
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TestBedApplicationErrorHandler, [{
|
|
192
|
-
type: Injectable
|
|
193
|
-
}], null, null); })();
|
|
194
|
-
|
|
195
195
|
/**
|
|
196
196
|
* Fixture for debugging and testing a component.
|
|
197
197
|
*
|
|
@@ -244,7 +244,7 @@ class ComponentFixture {
|
|
|
244
244
|
subscriptions = new Subscription();
|
|
245
245
|
// TODO(atscott): Remove this from public API
|
|
246
246
|
ngZone = this._noZoneOptionIsSet ? null : this._ngZone;
|
|
247
|
-
/** @
|
|
247
|
+
/** @docs-private */
|
|
248
248
|
constructor(componentRef) {
|
|
249
249
|
this.componentRef = componentRef;
|
|
250
250
|
this.changeDetectorRef = componentRef.changeDetectorRef;
|
|
@@ -253,13 +253,15 @@ class ComponentFixture {
|
|
|
253
253
|
this.componentInstance = componentRef.instance;
|
|
254
254
|
this.nativeElement = this.elementRef.nativeElement;
|
|
255
255
|
this.componentRef = componentRef;
|
|
256
|
+
this._testAppRef.allTestViews.add(this.componentRef.hostView);
|
|
256
257
|
if (this.autoDetect) {
|
|
257
|
-
this._testAppRef.
|
|
258
|
+
this._testAppRef.autoDetectTestViews.add(this.componentRef.hostView);
|
|
258
259
|
this.scheduler?.notify(8 /* ɵNotificationSource.ViewAttached */);
|
|
259
260
|
this.scheduler?.notify(0 /* ɵNotificationSource.MarkAncestorsForTraversal */);
|
|
260
261
|
}
|
|
261
262
|
this.componentRef.hostView.onDestroy(() => {
|
|
262
|
-
this._testAppRef.
|
|
263
|
+
this._testAppRef.allTestViews.delete(this.componentRef.hostView);
|
|
264
|
+
this._testAppRef.autoDetectTestViews.delete(this.componentRef.hostView);
|
|
263
265
|
});
|
|
264
266
|
// Create subscriptions outside the NgZone so that the callbacks run outside
|
|
265
267
|
// of NgZone.
|
|
@@ -293,13 +295,11 @@ class ComponentFixture {
|
|
|
293
295
|
}
|
|
294
296
|
if (this.zonelessEnabled) {
|
|
295
297
|
try {
|
|
296
|
-
this._testAppRef.
|
|
298
|
+
this._testAppRef.includeAllTestViews = true;
|
|
297
299
|
this._appRef.tick();
|
|
298
300
|
}
|
|
299
301
|
finally {
|
|
300
|
-
|
|
301
|
-
this._testAppRef.externalTestViews.delete(this.componentRef.hostView);
|
|
302
|
-
}
|
|
302
|
+
this._testAppRef.includeAllTestViews = false;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
else {
|
|
@@ -323,24 +323,18 @@ class ComponentFixture {
|
|
|
323
323
|
checkNoChanges() {
|
|
324
324
|
this.changeDetectorRef.checkNoChanges();
|
|
325
325
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Set whether the fixture should autodetect changes.
|
|
328
|
-
*
|
|
329
|
-
* Also runs detectChanges once so that any existing change is detected.
|
|
330
|
-
*
|
|
331
|
-
* @param autoDetect Whether to autodetect changes. By default, `true`.
|
|
332
|
-
*/
|
|
333
326
|
autoDetectChanges(autoDetect = true) {
|
|
327
|
+
if (!autoDetect && this.zonelessEnabled) {
|
|
328
|
+
throw new Error('Cannot set autoDetect to false with zoneless change detection.');
|
|
329
|
+
}
|
|
334
330
|
if (this._noZoneOptionIsSet && !this.zonelessEnabled) {
|
|
335
331
|
throw new Error('Cannot call autoDetectChanges when ComponentFixtureNoNgZone is set.');
|
|
336
332
|
}
|
|
337
|
-
if (autoDetect
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
this._testAppRef.externalTestViews.delete(this.componentRef.hostView);
|
|
343
|
-
}
|
|
333
|
+
if (autoDetect) {
|
|
334
|
+
this._testAppRef.autoDetectTestViews.add(this.componentRef.hostView);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
this._testAppRef.autoDetectTestViews.delete(this.componentRef.hostView);
|
|
344
338
|
}
|
|
345
339
|
this.autoDetect = autoDetect;
|
|
346
340
|
this.detectChanges();
|
|
@@ -404,7 +398,8 @@ class ComponentFixture {
|
|
|
404
398
|
*/
|
|
405
399
|
destroy() {
|
|
406
400
|
this.subscriptions.unsubscribe();
|
|
407
|
-
this._testAppRef.
|
|
401
|
+
this._testAppRef.autoDetectTestViews.delete(this.componentRef.hostView);
|
|
402
|
+
this._testAppRef.allTestViews.delete(this.componentRef.hostView);
|
|
408
403
|
if (!this._isDestroyed) {
|
|
409
404
|
this.componentRef.destroy();
|
|
410
405
|
this._isDestroyed = true;
|
|
@@ -429,7 +424,7 @@ function resetFakeAsyncZone() {
|
|
|
429
424
|
throw new Error(fakeAsyncTestModuleNotLoadedErrorMessage);
|
|
430
425
|
}
|
|
431
426
|
function resetFakeAsyncZoneIfExists() {
|
|
432
|
-
if (fakeAsyncTestModule) {
|
|
427
|
+
if (fakeAsyncTestModule && Zone['ProxyZoneSpec']?.isLoaded()) {
|
|
433
428
|
fakeAsyncTestModule.resetFakeAsyncZone();
|
|
434
429
|
}
|
|
435
430
|
}
|
|
@@ -879,9 +874,7 @@ class TestBedCompiler {
|
|
|
879
874
|
moduleDef.rethrowApplicationErrors ?? RETHROW_APPLICATION_ERRORS_DEFAULT;
|
|
880
875
|
}
|
|
881
876
|
overrideModule(ngModule, override) {
|
|
882
|
-
|
|
883
|
-
depsTracker.clearScopeCacheFor(ngModule);
|
|
884
|
-
}
|
|
877
|
+
depsTracker.clearScopeCacheFor(ngModule);
|
|
885
878
|
this.overriddenModules.add(ngModule);
|
|
886
879
|
// Compile the module right away.
|
|
887
880
|
this.resolvers.module.addOverride(ngModule, override);
|
|
@@ -1097,9 +1090,7 @@ class TestBedCompiler {
|
|
|
1097
1090
|
throw invalidTypeError(declaration.name, 'Component');
|
|
1098
1091
|
}
|
|
1099
1092
|
this.maybeStoreNgDef(NG_COMP_DEF, declaration);
|
|
1100
|
-
|
|
1101
|
-
depsTracker.clearScopeCacheFor(declaration);
|
|
1102
|
-
}
|
|
1093
|
+
depsTracker.clearScopeCacheFor(declaration);
|
|
1103
1094
|
compileComponent(declaration, metadata);
|
|
1104
1095
|
});
|
|
1105
1096
|
this.pendingComponents.clear();
|
|
@@ -1132,9 +1123,7 @@ class TestBedCompiler {
|
|
|
1132
1123
|
const affectedModules = this.collectModulesAffectedByOverrides(testingModuleDef.imports);
|
|
1133
1124
|
if (affectedModules.size > 0) {
|
|
1134
1125
|
affectedModules.forEach((moduleType) => {
|
|
1135
|
-
|
|
1136
|
-
depsTracker.clearScopeCacheFor(moduleType);
|
|
1137
|
-
}
|
|
1126
|
+
depsTracker.clearScopeCacheFor(moduleType);
|
|
1138
1127
|
});
|
|
1139
1128
|
}
|
|
1140
1129
|
}
|
|
@@ -1455,9 +1444,7 @@ class TestBedCompiler {
|
|
|
1455
1444
|
});
|
|
1456
1445
|
// Restore initial component/directive/pipe defs
|
|
1457
1446
|
this.initialNgDefs.forEach((defs, type) => {
|
|
1458
|
-
|
|
1459
|
-
depsTracker.clearScopeCacheFor(type);
|
|
1460
|
-
}
|
|
1447
|
+
depsTracker.clearScopeCacheFor(type);
|
|
1461
1448
|
defs.forEach((descriptor, prop) => {
|
|
1462
1449
|
if (!descriptor) {
|
|
1463
1450
|
// Delete operations are generally undesirable since they have performance
|
|
@@ -1872,6 +1859,9 @@ class TestBedImpl {
|
|
|
1872
1859
|
static get ngModule() {
|
|
1873
1860
|
return TestBedImpl.INSTANCE.ngModule;
|
|
1874
1861
|
}
|
|
1862
|
+
static flushEffects() {
|
|
1863
|
+
return TestBedImpl.INSTANCE.tick();
|
|
1864
|
+
}
|
|
1875
1865
|
static tick() {
|
|
1876
1866
|
return TestBedImpl.INSTANCE.tick();
|
|
1877
1867
|
}
|
|
@@ -1884,7 +1874,7 @@ class TestBedImpl {
|
|
|
1884
1874
|
/**
|
|
1885
1875
|
* Internal-only flag to indicate whether a module
|
|
1886
1876
|
* scoping queue has been checked and flushed already.
|
|
1887
|
-
* @
|
|
1877
|
+
* @docs-private
|
|
1888
1878
|
*/
|
|
1889
1879
|
globalCompilationChecked = false;
|
|
1890
1880
|
/**
|
|
@@ -2196,13 +2186,32 @@ class TestBedImpl {
|
|
|
2196
2186
|
testRenderer.removeAllRootElements?.();
|
|
2197
2187
|
}
|
|
2198
2188
|
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Execute any pending effects by executing any pending work required to synchronize model to the UI.
|
|
2191
|
+
*
|
|
2192
|
+
* @deprecated use `TestBed.tick()` instead
|
|
2193
|
+
*/
|
|
2194
|
+
flushEffects() {
|
|
2195
|
+
this.tick();
|
|
2196
|
+
}
|
|
2199
2197
|
/**
|
|
2200
2198
|
* Execute any pending work required to synchronize model to the UI.
|
|
2201
2199
|
*
|
|
2202
2200
|
* @publicApi
|
|
2203
2201
|
*/
|
|
2204
2202
|
tick() {
|
|
2205
|
-
this.inject(ApplicationRef)
|
|
2203
|
+
const appRef = this.inject(ApplicationRef);
|
|
2204
|
+
try {
|
|
2205
|
+
// TODO(atscott): ApplicationRef.tick should set includeAllTestViews to true itself rather than doing this here and in ComponentFixture
|
|
2206
|
+
// The behavior should be that TestBed.tick, ComponentFixture.detectChanges, and ApplicationRef.tick all result in the test fixtures
|
|
2207
|
+
// getting synchronized, regardless of whether they are autoDetect: true.
|
|
2208
|
+
// Automatic scheduling (zone or zoneless) will call _tick which will _not_ include fixtures with autoDetect: false
|
|
2209
|
+
appRef.includeAllTestViews = true;
|
|
2210
|
+
appRef.tick();
|
|
2211
|
+
}
|
|
2212
|
+
finally {
|
|
2213
|
+
appRef.includeAllTestViews = false;
|
|
2214
|
+
}
|
|
2206
2215
|
}
|
|
2207
2216
|
}
|
|
2208
2217
|
/**
|