Repository navigation
v0.3.0
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 forvalidateFormand then had no way to act on the answer.validateon 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: avisible,onorrepeatthat a model put insidepropsis moved back out, where it actually takes effect. The check is skipped whileloading, because a half-streamed spec referring to children that have not arrived yet is normal, not broken. Available oninjectUIStream/injectChatUItoo, with the findings exposed as anissuessignal.- 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 behindprefers-color-scheme, its two words are overridable throughJR_CONFIRM_LABELS, and the whole component can be swapped for your design system's modal throughJR_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
validateFormthen 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, andvalidateSpec/autoFixSpec/formatSpecIssuesre-exported from@json-render/core.
Upgrading
npm i ngx-json-render@0.3.0 ngx-json-render-material@0.3.0Install 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