fill method infrastructure ✓ 100.0%

Last updated: 2026-03-04T23:21:38.381Z

Metrics

LOC: 35 Complexity: 8 Params: 2 Coverage: 100.0% (13/13 lines, 6x executed)

Signature

fill(wrapper: HTMLElement, value: string): : boolean

Source Code

  fill(wrapper: HTMLElement, value: string): boolean {
    const labels = wrapper.querySelectorAll<HTMLElement>(
      ".ant-checkbox-wrapper",
    );

    // Try matching by value or text
    for (const label of labels) {
      const input = label.querySelector<HTMLInputElement>(
        "input[type='checkbox']",
      );
      const text = label.textContent?.trim() ?? "";

      if (
        input?.value === value ||
        text.toLowerCase() === value.toLowerCase() ||
        text.toLowerCase().includes(value.toLowerCase())
      ) {
        if (!label.classList.contains("ant-checkbox-wrapper-checked")) {
          simulateClick(label);
        }
        return true;
      }
    }

    // Fallback: check the first unchecked checkbox
    const unchecked = wrapper.querySelector<HTMLElement>(
      ".ant-checkbox-wrapper:not(.ant-checkbox-wrapper-checked)",
    );
    if (unchecked) {
      simulateClick(unchecked);
      return true;
    }

    return false;
  },

Dependencies (Outgoing)

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

No incoming dependencies.