Debug Element & DOM events in angular unit test

Debug Element & DOM events in angular unit test

DebugElement is an Angular class that contains all kinds of references and methods relevant to investigate an element as well as component fixture.debugElement.query(By.css(‘#h1’))

Instead of creating an HTML element tree, Angular creates a DebugElement tree that wraps the native elements for the runtime platform.

 The nativeElement property unwraps the DebugElement and returns the platform-specific element object.


nativeElement returns a reference to the DOM element.

triggerEventHandler is a function that exists on Angular's DebugElement.


https://angular.io/api/core/DebugElement


you can learn more on it from below video




Share this

Related Posts

Previous
Next Post »