* 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>)
| 335 | * Protractor and is executed inside the browser. |
| 336 | */ |
| 337 | function _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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected