fill method infrastructure ✓ 100.0%
Last updated: 2026-03-04T23:21:38.388Z
Metrics
LOC: 47
Complexity: 8
Params: 2
Coverage: 100.0% (20/20 lines, 4x executed)
Signature
fill(wrapper: HTMLElement, _value: string): : boolean
Source Code
fill(wrapper: HTMLElement, _value: string): boolean {
const lists = wrapper.querySelectorAll<HTMLElement>(".ant-transfer-list");
if (lists.length < 2) return false;
const sourceList = lists[0];
const sourceItems = sourceList.querySelectorAll<HTMLElement>(
".ant-transfer-list-content-item:not(.ant-transfer-list-content-item-disabled)",
);
if (sourceItems.length === 0) return false;
// Select a random subset of items (at least 1, up to half)
const count = Math.max(
1,
Math.floor(Math.random() * Math.ceil(sourceItems.length / 2)),
);
const indices = new Set<number>();
while (indices.size < count) {
indices.add(Math.floor(Math.random() * sourceItems.length));
}
// Click each selected item's checkbox
for (const idx of indices) {
const checkbox = sourceItems[idx].querySelector<HTMLElement>(
".ant-checkbox-wrapper:not(.ant-checkbox-wrapper-checked)",
);
if (checkbox) {
simulateClick(checkbox);
}
}
// Click the "move to target" button (first button in operation area)
const operationArea = wrapper.querySelector<HTMLElement>(
".ant-transfer-operation",
);
if (operationArea) {
const moveBtn = operationArea.querySelector<HTMLButtonElement>(
"button:not([disabled])",
);
if (moveBtn) {
simulateClick(moveBtn);
return true;
}
}
return false;
},
Dependencies (Outgoing)
| Target | Type |
|---|---|
| simulateClick | calls |
No incoming dependencies.