Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 01 Sep 06:20
· 228 commits to main since this release

Test your generated UI without calling a model.

The headline is a new entry point, ngx-json-render/testing. It ships nothing into your application bundle and gives a spec test the two things that were being rewritten in every project that had them:

import { renderSpec, recordedTransport } from 'ngx-json-render/testing';

const ui = await renderSpec(spec, { registry: materialRegistry });
await ui.click('button');
expect(ui.dispatched).toEqual([{ name: 'save', params: {} }]);

renderSpec mounts a spec against a registry and hands back the store, the validation state, the dispatched actions and the usual click/fill/read helpers — no host component, no TestBed module, no settling by hand. recordedTransport replays a recorded generation as a real SpecStream, so the streaming path can be tested end to end against a fixture instead of a live model.

Also in this release

  • submitForm — a built-in action that validates every bound field and dispatches your submit action only if they all pass. Previously a spec could ask for validateForm and then had no way to act on the answer.
  • validate on the renderer — 'warn' reports structural problems in a spec and renders anyway, 'strict' refuses to render a broken one. Both first apply the lossless fixes: a visible, on or repeat that a model put inside props is moved back out, where it actually takes effect. The check is skipped while loading, because a half-streamed spec referring to children that have not arrived yet is normal, not broken. Available on injectUIStream / injectChatUI too, with the findings exposed as an issues signal.
  • A confirmation dialog you can live with. It is now a real modal — role="dialog", aria-modal, focus into the dialog and back to the trigger on close, Escape to dismiss, Tab wrapping at the ends. Its colours are CSS custom properties with dark defaults behind prefers-color-scheme, its two words are overridable through JR_CONFIRM_LABELS, and the whole component can be swapped for your design system's modal through JR_CONFIRM_DIALOG.
  • A leak fix for specs that change. The validation registry and the Material tab registry never released fields and tabs the spec had removed, so a long-lived streaming session accumulated entries that validateForm then reported on. Both now unregister.
  • Angular 22. The peer range is unchanged at >=20, but CI now proves both ends of it rather than the floor alone — the matrix builds and tests the library on 20 and 22 on every push.
  • New exports: isActionCancelled, ELEMENT_KEY / injectElementKey, checkSpec, and validateSpec / autoFixSpec / formatSpecIssues re-exported from @json-render/core.

Upgrading

npm i ngx-json-render@0.3.0 ngx-json-render-material@0.3.0

Install both: the catalog's peer range moves with the renderer, and npm resolves a mismatched pair by quietly picking an older renderer.

One thing to check before upgrading: built-in actions are dispatched before your own handlers, and submitForm is now built in. If your app already registers a handler named submitForm, rename it — the built-in will take precedence.

Full Changelog: v0.2.1...v0.3.0