handleCheck function

Last updated: 2026-03-05T20:45:07.036Z

Metrics

LOC: 16 Complexity: 3 Params: 2

Signature

handleCheck(step: FlowStep, checked: boolean): : StepResult

Source Code

function handleCheck(step: FlowStep, checked: boolean): StepResult {
  const el = requireElement(step);
  ensureVisible(el);

  if (!(el instanceof HTMLInputElement)) {
    return { status: "failed", error: "Check target is not an input" };
  }

  if (el.checked !== checked) {
    el.checked = checked;
    el.dispatchEvent(new Event("change", { bubbles: true }));
    el.dispatchEvent(new Event("click", { bubbles: true }));
  }

  return { status: "success" };
}

Dependencies (Outgoing)

graph LR handleCheck["handleCheck"] requireElement["requireElement"] ensureVisible["ensureVisible"] handleCheck -->|calls| requireElement handleCheck -->|calls| ensureVisible style handleCheck fill:#dbeafe,stroke:#2563eb,stroke-width:2px click handleCheck "925d9bcf5b79be5d.html" click requireElement "54b35883ca14f405.html" click ensureVisible "12336ba1f5ec5dde.html"
TargetType
requireElement calls
ensureVisible calls

Impact (Incoming)

graph LR handleCheck["handleCheck"] executeStep["executeStep"] executeStep -->|calls| handleCheck style handleCheck fill:#dbeafe,stroke:#2563eb,stroke-width:2px click handleCheck "925d9bcf5b79be5d.html" click executeStep "a26ccfb820921de2.html"
SourceType
executeStep calls