Angular Testing Library

The new on property improves output testing in Angular Testing Library

Tim Deschryver

The latest version of the Angular Testing Library (v17.1.0) has introduced a new API 'on', which allows more intuitive testing of the output of components. This API is seen as a better alternative to 'componentOutputs' or 'componentProperties'. The new method provides type safety and obviates the need to create a "fake" event emitter, making it easier to assign a spy to the output properties. The 'on' API also unsubscribes from output properties when a component is destroyed or rerendered. The changes render 'componentOutputs' and 'componentProperties' obsolete and they will be removed in the next major version update.

read full post