Change code new Event in documentation error in Angular aio

In Angular testing-attribute-directives in app/shared/highlight.directive.spec.ts (selected tests) in this part of code is wrong.
url: https://angular.io/guide/testing-attribute-directives

// dispatch a DOM event so that Angular responds to the input value change.
input.value = ‘green’;
input.dispatchEvent(newEvent(‘input’));
fixture.detectChanges();

Should be input.dispatchEvent(new Event(‘input’)); and not input.dispatchEvent(newEvent(‘input’));

1 possible answer(s) on “Change code new Event in documentation error in Angular aio

  1. Oh, we were supposed to have gotten rid of the newEvent() helper with #37251. Somehow it had slipped through the cracks.
    I’ll rebase it and fix it up and we can hopefully merge it soon.

    Thx for bringing it up, @renatodysouza and @sonukapoor for bringing it to my attention.
    I’ll go ahead and close this. Please follow #37251 for updates/ongoing discussion.