Testing NeuralNg
Test the behavior your users observe: values, events, roles, keyboard flows, focus and visible state—not NeuralNg’s private DOM arrangement.
CONSUMER TESTS
Assert the public contract
A useful application test asks whether a person can operate the control and whether your application receives the expected value. Internal class names, generated IDs and exact wrapper counts are not stable selectors unless the component explicitly documents them as public class slots.
Import the same component your application uses
Create a small host component when the behavior spans template binding and application state. Standalone imports keep the test setup identical to production usage.
Read models after user interaction
Trigger the native interaction, then assert the bound Signal or semantic output. Programmatically assigning a model tests application state; clicking, typing or pressing a key tests the user path. Keep both when both contracts matter.
Test through the selected Forms API
For Reactive Forms, assert the FormControl value, disabled state, touched state and validation. Apply the same principle to template-driven and Signal Forms: inspect the public form model instead of reaching into the component instance.
Dispatch real keyboard events
Composite controls require more than click coverage. Test opening, roving focus, selection, Escape dismissal and focus restoration with the documented key contract. Assert roles and ARIA state rather than a visual highlight class.
Query appended overlays from document.body
Panels using appendTo="body" are outside the fixture root by design. Query the document by role, close or destroy the host after each test and avoid sharing an open overlay between cases.
Control asynchronous time deliberately
Debounce
Advance the configured delay and verify stale remote results do not replace the latest query.
Loading
Assert busy semantics, disabled interaction and the final settled state.
Toast lifetime
Use controlled timers for dismissal and keep persistent messages explicit.
Animations
Wait for the semantic state or reduced-motion path, not an arbitrary sleep.
Combine automation with keyboard inspection
Automated rules catch missing names, invalid relationships and many contrast issues, but they do not prove that a date grid, tree or dialog feels correct with a keyboard and screen reader.
Exercise the production rendering path
For SSR applications, test at least one production-rendered route with JavaScript delayed or disabled, then hydrate it and operate the control. This catches browser-global access and server/client identity mismatches that a DOM-only unit test cannot see.