fillCustomComponent function presentation exported ✓ 100.0%

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

Metrics

LOC: 29 Complexity: 5 Params: 3 Coverage: 100.0% (13/13 lines, 5x executed)

Signature

fillCustomComponent( field: FormField, value: string, ): : Promise<boolean>

Summary

Fills a custom component field using its adapter. Returns true if the adapter handled the fill, false otherwise. Supports both sync and async adapters.

Source Code

export async function fillCustomComponent(
  field: FormField,
  value: string,
): Promise<boolean> {
  const adapterName = field.adapterName as AdapterName | undefined;
  if (!adapterName) return false;

  const adapter = getAdapter(adapterName);
  if (!adapter) {
    log.warn(`Adapter "${adapterName}" não encontrado para preenchimento`);
    return false;
  }

  try {
    const result = await adapter.fill(field.element as HTMLElement, value);
    if (!result) {
      log.warn(
        `[${adapter.name}] fill() retornou false para: ${field.selector}`,
      );
    }
    return result;
  } catch (err) {
    log.warn(
      `[${adapter.name}] Erro ao preencher campo ${field.selector}:`,
      err,
    );
    return false;
  }
}

Dependencies (Outgoing)

graph LR fillCustomComponent["fillCustomComponent"] getAdapter["getAdapter"] fillCustomComponent -->|calls| getAdapter style fillCustomComponent fill:#dbeafe,stroke:#2563eb,stroke-width:2px click fillCustomComponent "fb27203fbaa0cd9b.html" click getAdapter "fb0f4a5fd9ac2a4b.html"
TargetType
getAdapter calls

Impact (Incoming)

graph LR fillCustomComponent["fillCustomComponent"] setNativeValue["setNativeValue"] applyValueToField["applyValueToField"] makeAdapter["makeAdapter"] setNativeValue -->|uses| fillCustomComponent applyValueToField -->|calls| fillCustomComponent makeAdapter -->|uses| fillCustomComponent style fillCustomComponent fill:#dbeafe,stroke:#2563eb,stroke-width:2px click fillCustomComponent "fb27203fbaa0cd9b.html" click setNativeValue "334bd99609d7c37c.html" click applyValueToField "59a962012828c5cb.html" click makeAdapter "7cbe03be6bdb4b2d.html"
SourceType
setNativeValue uses
applyValueToField calls
makeAdapter uses