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)
| Target | Type |
|---|---|
| getAdapter | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| setNativeValue | uses |
| applyValueToField | calls |
| makeAdapter | uses |