angular/packages/core/test/acceptance
Andrew Scott ad045efd4b fix(core): Ensure views marked for check are refreshed during change detection (#54735)
When a view has the `Dirty` flag and is reattached, we should ensure that it is
reached and refreshed during the next change detection run from above.

In addition, when a view is created and attached, we should ensure that it is reached
and refreshed during change detection. This can happen if the view is
created and attached outside a change run or when it is created and
attached after its insertion view was already checked. In both cases, we
should ensure that the view is reached and refreshed during either the
current change detection or the next one (if change detection is not
already running).

We can achieve this by creating all views with the `Dirty` flag set.

However, this does happen to be a breaking change in some scenarios.
The one identified internally was actually depending on change detection
_not_ running immediately because it relied on an input value that was
set using `ngModel`. Because `ngModel` sets its value in a `Promise`, it
is not available until the _next_ change detection cycle. Ensuring
created views run in the current change change detection will result in
different behavior in this case.

fixes #52928
fixes #15634

BREAKING CHANGE: Newly created and views marked for check and reattached
during change detection are now guaranteed to be refreshed in that same
change detection cycle. Previously, if they were attached at a location
in the view tree that was already checked, they would either throw
`ExpressionChangedAfterItHasBeenCheckedError` or not be refreshed until
some future round of change detection. In rare circumstances, this
correction can cause issues. We identified one instance that relied on
the previous behavior by reading a value on initialization which was
queued to be updated in a microtask instead of being available in the
current change detection round. The component only read this value during
initialization and did not read it again after the microtask updated it.

PR Close #54735
2024-03-06 15:44:09 -08:00
..
authoring test: add runtime tests for output() function API (#54650) 2024-03-06 12:34:39 +01:00
after_render_hook_spec.ts fix(core): Change Detection will continue to refresh views while marked for check (#54734) 2024-03-06 15:43:16 -08:00
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts test(core): convert view container TemplateFixture tests to TestBed (#46544) 2022-06-28 11:15:02 -07:00
BUILD.bazel build: replace base64-js package with Node.js Buffer usage (#53464) 2023-12-11 14:04:06 -08:00
change_detection_signals_in_zones_spec.ts test(core): ExpressionChanged... error does not happen with signals (#54206) 2024-02-02 14:51:46 +00:00
change_detection_spec.ts fix(core): Ensure views marked for check are refreshed during change detection (#54735) 2024-03-06 15:44:09 -08:00
change_detection_transplanted_view_spec.ts fix(core): Change Detection will continue to refresh views while marked for check (#54734) 2024-03-06 15:43:16 -08:00
common_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts refactor(core): add forbidOrphanRendering option to class debug info (#52061) 2023-10-10 15:30:26 -07:00
content_spec.ts fix(core): more accurate matching of classes during content projection (#48888) 2023-03-20 16:07:13 +01:00
control_flow_for_spec.ts fix(compiler): project empty block root node (#53620) 2023-12-19 08:37:33 -08:00
control_flow_if_spec.ts test(core): add tests for control flow content projection with ng-container (#53190) 2023-11-28 11:18:43 +01:00
control_flow_switch_spec.ts fix(compiler): project control flow root elements into correct slot (#52414) 2023-10-31 14:52:30 -07:00
copy_definition_feature_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
csp_spec.ts fix(platform-browser): set nonce attribute in a platform compatible way (#49624) 2023-03-29 09:26:54 -07:00
defer_spec.ts fix(core): collect providers from NgModules while rendering @defer block (#52881) 2024-02-23 12:30:05 -08:00
destroy_ref_spec.ts fix(core): allow onDestroy unregistration while destroying (#50237) 2023-05-11 10:17:07 -07:00
di_forward_ref_spec.ts test: update acceptance core tests to work with es2015 (#44505) 2022-01-05 23:20:21 +00:00
di_spec.ts feat(core): add API to inject attributes on the host node (#54604) 2024-02-27 15:18:41 -08:00
directive_spec.ts build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
discover_utils_spec.ts build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
embedded_views_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
env_injector_standalone_spec.ts fix(core): make parent injector argument required in createEnvironmentInjector (#46397) 2022-06-17 09:17:24 -07:00
environment_injector_spec.ts fix(core): allow onDestroy unregistration while destroying (#50237) 2023-05-11 10:17:07 -07:00
exports_spec.ts refactor(core): Improve ExpressionChangedAfterItHasBeenCheckedError (#50286) 2023-05-16 09:24:51 -07:00
host_binding_spec.ts refactor(core): Use (where applicable), ViewContainer.createComponent instead of relying on the ComponentFactoryResolver. (#49614) 2023-03-30 11:43:35 -07:00
host_directives_spec.ts fix(core): inherit host directives (#52992) 2023-11-20 13:16:15 -08:00
i18n_spec.ts fix(compiler): generate i18n instructions for blocks (#52958) 2023-11-20 08:59:25 -08:00
inherit_definition_feature_spec.ts fix(core): do not accidentally inherit input transforms when overridden (#53571) 2024-01-04 12:07:13 -08:00
injector_profiler_spec.ts fix(core): handle non-container environment injector cases (#52774) 2023-11-13 16:21:03 +00:00
integration_spec.ts refactor(core): remove unnecessary import for custom expect. (#51216) 2023-08-07 09:22:17 -07:00
lifecycle_spec.ts refactor(router): run spell check on router package (#50445) 2023-05-24 13:56:56 +00:00
listener_spec.ts test(core): convert listener TemplateFixture tests to TestBed (#46509) 2022-06-27 09:04:39 -07:00
local_compilation_spec.ts refactor(core): flatten and resolve ng-module bootstrap info in local compilation mode (#51767) 2023-09-18 16:59:55 +02:00
ng_module_spec.ts refactor(core): remove unnecessary import for custom expect. (#51216) 2023-08-07 09:22:17 -07:00
ngmodule_scope_spec.ts fix(core): prevent NgModule scope being overwritten in JIT compiler (#37795) 2020-08-11 09:50:27 -07:00
outputs_spec.ts build: update rxjs build version to v7 (#53500) 2023-12-18 16:25:37 +00:00
pending_tasks_spec.ts refactor(core): Rename InitialRenderPendingTasks and restructure isStable observable (#53534) 2023-12-19 08:36:28 -08:00
pipe_spec.ts refactor(platform-browser): replace our own toBeAnInstanceOf with toBeInstanceOf (#50661) 2023-06-14 10:58:04 +02:00
profiler_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
property_binding_spec.ts build: update rxjs build version to v7 (#53500) 2023-12-18 16:25:37 +00:00
property_interpolation_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts refactor(platform-browser): replace our own toBeAnInstanceOf with toBeInstanceOf (#50661) 2023-06-14 10:58:04 +02:00
pure_function_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
query_spec.ts refactor(core): remove unnecessary import for custom expect. (#51216) 2023-08-07 09:22:17 -07:00
renderer_factory_spec.ts refactor(core): node removal notifies scheduler only when animations are enabled (#53857) 2024-01-19 10:28:24 +01:00
router_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
security_spec.ts docs(core): add an error details page for unsafe <iframe> bindings (#48027) 2022-11-11 11:28:35 -08:00
standalone_injector_spec.ts refactor(core): Use (where applicable), ViewContainer.createComponent instead of relying on the ComponentFactoryResolver. (#49614) 2023-03-30 11:43:35 -07:00
standalone_spec.ts Revert "refactor(core): improve forwardRef typings (#53880)" (#53961) 2024-01-17 13:56:07 -08:00
styling_spec.ts feat(core): support styles and styleUrl as strings (#51715) 2023-09-12 13:57:07 -07:00
template_ref_spec.ts refactor(core): deprecate allowing full context object to be replaced in EmbeddedViewRef (#51887) 2023-10-04 08:14:35 -07:00
text_spec.ts build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
view_container_ref_spec.ts refactor(platform-browser): replace our own toBeAnInstanceOf with toBeInstanceOf (#50661) 2023-06-14 10:58:04 +02:00
view_insertion_spec.ts refactor(core): Use (where applicable), ViewContainer.createComponent instead of relying on the ComponentFactoryResolver. (#49614) 2023-03-30 11:43:35 -07:00
view_ref_spec.ts refactor(core): Remove RootViewRef<T> because it is the same as ViewRef<T> (#52430) 2023-11-08 08:50:50 -08:00