fill method infrastructure ✓ 84.6%
Last updated: 2026-03-04T23:21:38.385Z
Metrics
LOC: 26
Complexity: 5
Params: 2
Coverage: 84.6% (11/13 lines, 5x executed)
Signature
fill(wrapper: HTMLElement, value: string): : boolean
Source Code
fill(wrapper: HTMLElement, value: string): boolean {
const stars = wrapper.querySelectorAll<HTMLElement>(".ant-rate-star");
if (stars.length === 0) return false;
let target = parseInt(value, 10);
if (isNaN(target) || target < 1) {
// Random value between 3 and total
target = Math.max(3, Math.floor(Math.random() * stars.length) + 1);
}
// Clamp to range
target = Math.min(target, stars.length);
// Click the target star (1-indexed → 0-indexed)
const star = stars[target - 1];
const clickTarget = star.querySelector<HTMLElement>(
".ant-rate-star-second",
);
if (clickTarget) {
simulateClick(clickTarget);
return true;
}
simulateClick(star);
return true;
},
Dependencies (Outgoing)
| Target | Type |
|---|---|
| simulateClick | calls |
No incoming dependencies.