Overview of the ngMocks namespace
mainThe ngMocks namespace is a collection of helper functions designed to simplify Angular testing. It provides tools for:
- Customizing mock behavior: Controlling how components, services, and other dependencies are mocked.
- Simulating events: Triggering form control events (like
changeortouch) and standard HTML events (likeclick). - Manipulating templates: Rendering or hiding
ng-templateelements. - Accessing elements and instances: Finding DOM elements, component instances, and
TemplateRefobjects within a fixture. - Stubbing: Replacing specific methods or properties on objects with stubs.
- Test helpers: Utilities for managing the console, formatting output, and cleaning up the
TestBed.