fill method infrastructure ✓ 100.0%
Last updated: 2026-03-04T23:21:38.381Z
Metrics
LOC: 27
Complexity: 3
Params: 2
Coverage: 100.0% (10/10 lines, 4x executed)
Signature
fill(wrapper: HTMLElement, value: string): : boolean
Source Code
fill(wrapper: HTMLElement, value: string): boolean {
const input = wrapper.querySelector<HTMLInputElement>("input");
if (!input) return false;
// Open the picker
simulateClick(input);
// Set the value
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLInputElement.prototype,
"value",
)?.set;
if (nativeInputValueSetter) {
nativeInputValueSetter.call(input, value);
}
input.dispatchEvent(new Event("input", { bubbles: true }));
input.dispatchEvent(new Event("change", { bubbles: true }));
// Simulate Enter key to confirm
input.dispatchEvent(
new KeyboardEvent("keydown", { key: "Enter", bubbles: true }),
);
return true;
},
Dependencies (Outgoing)
| Target | Type |
|---|---|
| simulateClick | calls |
No incoming dependencies.