MCPcopy Create free account
hub / github.com/angular/components / _dispatchEvent

Function _dispatchEvent

src/cdk/testing/protractor/protractor-element.ts:337–348  ·  view source on GitHub ↗

* Dispatches an event with a particular name and data to an element. * Note that this needs to be a pure function, because it gets stringified by * Protractor and is executed inside the browser.

(name: string, element: ElementFinder, data?: Record<string, EventData>)

Source from the content-addressed store, hash-verified

335 * Protractor and is executed inside the browser.
336 */
337function _dispatchEvent(name: string, element: ElementFinder, data?: Record<string, EventData>) {
338 const event = document.createEvent('Event');
339 event.initEvent(name);
340
341 if (data) {
342 // tslint:disable-next-line:ban Have to use `Object.assign` to preserve the original object.
343 Object.assign(event, data);
344 }
345
346 // This type has a string index signature, so we cannot access it using a dotted property access.
347 element['dispatchEvent'](event);
348}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected