(sel, v, doc)
| 12448 | } |
| 12449 | |
| 12450 | async function inputAction(sel, v, doc) { |
| 12451 | let input = await waitForElement(sel, doc); |
| 12452 | let event = new Event('focus', { bubbles: true }); |
| 12453 | input.dispatchEvent(event); |
| 12454 | let lastValue = input.value; |
| 12455 | if (input.nodeName.toUpperCase() == "INPUT") { |
| 12456 | var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set; |
| 12457 | nativeInputValueSetter.call(input, v); |
| 12458 | } else if (input.nodeName.toUpperCase() == "TEXTAREA") { |
| 12459 | var nativeTextareaValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value").set; |
| 12460 | nativeTextareaValueSetter.call(input, v); |
| 12461 | } else { |
| 12462 | setHTML(input, v); |
| 12463 | } |
| 12464 | event = new Event('input', { bubbles: true }); |
| 12465 | let tracker = input._valueTracker; |
| 12466 | if (tracker) { |
| 12467 | tracker.setValue(lastValue); |
| 12468 | } |
| 12469 | input.dispatchEvent(event); |
| 12470 | event = new Event('change', { bubbles: true }); |
| 12471 | input.dispatchEvent(event); |
| 12472 | debug(input, `input ${sel}`); |
| 12473 | } |
| 12474 | |
| 12475 | function emuClick(btn, doc) { |
| 12476 | if (!doc) doc = document; |
no test coverage detected