Skip to content

Angular: zoneless tests and core components fixes - #35749

Open
vorobey wants to merge 8 commits into
DevExpress:feature/angular-zoneless-supportfrom
vorobey:feature/angular-zoneless-support-wrappers
Open

vorobey wants to merge 8 commits into
DevExpress:feature/angular-zoneless-supportfrom
vorobey:feature/angular-zoneless-support-wrappers

Conversation

@vorobey

@vorobey vorobey commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

PR applies changes for supporting Angular zoneless mode (default for new Angular 21+ apps). Zone-based apps keep working as before; no breaking changes.

  • component.ts: injects ChangeDetectorRef and passes it to NgEventsStrategy and EmitterHelper
  • events-strategy.ts: fireEvent and fireNgEvent call markForCheck after emitting, so code subscriptions (.subscribe(), instance.on()) re-render the view in zoneless apps
  • optionChanged marks for check only for options bound by the app (registerBoundOption in component.ts / nested-option.ts), e.g. Form editing a one-way [formData] in place; internal state (hoveredElement, focusedElement) doesn't trigger change detection on hover
  • zone.run() / runOutsideAngular() are kept: no-op in zoneless apps, unchanged behavior in zone apps
  • tests: new zone and zoneless karma environments (nx-infra-plugin executor, shims) running tests/src/zone-modes, included in test:all; zone.js moved out of the common shim

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new suites are omitted from standard CI execution, and the drag test can mask a missing change-detection trigger.

2 open issues
What changed in this PR

Adds zone-based and zoneless change-detection tests for the Angular wrappers, supported by new Karma environments.

Changes:

  • Adds shared regression tests for both change-detection modes.
  • Separates Zone.js polyfills from common test setup.
  • Adds Nx test/debug targets and core-file lint directives.
File Description
packages/​nx-infra-plugin/​src/​executors/​karma-multi-env/​schema.json Allows both new environments.
packages/​nx-infra-plugin/​src/​executors/​karma-multi-env/​schema.d.ts Extends environment types.
packages/​nx-infra-plugin/​src/​executors/​karma-multi-env/​karma.types.ts Maps new environments to shims.
packages/​nx-infra-plugin/​src/​executors/​karma-multi-env/​karma-multi-env.impl.ts Includes new environments in execution order.
packages/​devextreme-angular/​tests/​src/​zone-modes/​change-detection.spec.ts Adds change-detection regression tests.
packages/​devextreme-angular/​src/​core/​events-strategy.ts Adds a lint suppression only.
packages/​devextreme-angular/​src/​core/​component.ts Adds a lint suppression only.
packages/​devextreme-angular/​project.json Adds test/debug targets and cache inputs.
packages/​devextreme-angular/​karma.zoneless.test.shim.js Initializes tests without Zone.js.
packages/​devextreme-angular/​karma.zoneless-testing.module.js Provides zoneless change detection.
packages/​devextreme-angular/​karma.zone.test.shim.js Initializes zone-based regression tests.
packages/​devextreme-angular/​karma.zone-polyfills.test.shim.js Centralizes Zone.js loading.
packages/​devextreme-angular/​karma.test.shim.js Uses zone polyfills and excludes dedicated suites.
packages/​devextreme-angular/​karma.server.test.shim.js Uses zone polyfills.
packages/​devextreme-angular/​karma.hydration.test.shim.js Uses zone polyfills.
packages/​devextreme-angular/​karma.common.test.shim.js Removes shared Zone.js loading.
packages/​devextreme-angular/​.gitignore Ignores Chrome Headless artifacts.

Review effort: Balanced

Comment thread packages/devextreme-angular/project.json
@vorobey
vorobey deleted the branch DevExpress:feature/angular-zoneless-support October 19, 2026 15:49
@vorobey vorobey closed this Oct 19, 2026
@vorobey vorobey reopened this Oct 19, 2026
@vorobey
vorobey requested a balanced review from Copilot October 19, 2026 15:51
@vorobey vorobey self-assigned this Oct 19, 2026
@vorobey vorobey added the 26_2 label Oct 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Programmatic option-change subscriptions can still leave zoneless views stale.

3 open issues

Review effort: Balanced

Comment thread packages/devextreme-angular/src/core/events-strategy.ts Outdated
@vorobey
vorobey marked this pull request as ready for review October 20, 2026 07:02
@vorobey vorobey removed the .d.ts label Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Public instance.on('optionChanged') handlers can still leave zoneless views stale.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread packages/devextreme-angular/src/core/events-strategy.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Callback-only nested widget events can still leave plain-field updates unrendered in zoneless applications.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Notify Angular for callback-only nested widget actions

packages/​devextreme-angular/​src/​core/​events-strategy.ts:34

The notification is still inside if (emitter.observers.length), so callback-only nested widgets are missed. For example, a toolbar button configured through items[].options.onClick can have no click emitter subscribers. Core _createActionByOption invokes fireEvent before executing the option callback separately (core/widget/component.ts:466–470); updating a plain host field in that callback does not notify Angular, leaving a zoneless view stale unless another change-detection trigger occurs. Cover user-configured option callbacks in the notification path and add a zoneless regression test, while preserving suppression for widget-internal callbacks.

3 resolved since last review

Review effort: Balanced

@vorobey
vorobey requested a review from a team October 20, 2026 13:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants