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)

graph LR fill["fill"] simulateClick["simulateClick"] fill -->|calls| simulateClick style fill fill:#dbeafe,stroke:#2563eb,stroke-width:2px click fill "81895804cf3f7bd2.html" click simulateClick "7c6c21320aaee4c4.html"
TargetType
simulateClick calls

No incoming dependencies.