mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-06 14:39:22 +00:00
test(dialog): measure the room toggle after its knob stops sliding (#712)
The second flake of smoke_dialog_polish_603: the knob slides with `transition: left .15s` and the probe waited a fixed 220 ms, 70 ms of slack that load ate (rightGap 3.05 and 5.6 instead of 2 in 2 of 20 loaded runs). The probe now waits until the toggle and its pseudo-elements have no running animation. The geometry oracle and its negative probe are unchanged. Issue: #712 User-Visible: no Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
This commit is contained in:
@@ -84,13 +84,24 @@ for (const dpr of [1, 2]) {
|
||||
target: toggle.getBoundingClientRect(),
|
||||
};
|
||||
};
|
||||
// #712: the knob slides with `transition: left .15s`. A fixed 220 ms
|
||||
// wait left 70 ms of slack and missed it under load; wait until the
|
||||
// toggle and its pseudo-elements have no running animation instead.
|
||||
const idle = async () => {
|
||||
for (let round = 0; round < 20; round++) {
|
||||
const running = toggle.getAnimations({ subtree: true })
|
||||
.filter((animation) => animation.playState !== 'finished' && animation.playState !== 'idle');
|
||||
if (!running.length) return;
|
||||
await Promise.all(running.map((animation) => animation.finished.catch(() => {})));
|
||||
}
|
||||
};
|
||||
toggle.checked = false; toggle.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
await settle();
|
||||
await new Promise((resolve) => setTimeout(resolve, 220));
|
||||
await idle();
|
||||
const off = measure();
|
||||
toggle.checked = true; toggle.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
await settle();
|
||||
await new Promise((resolve) => setTimeout(resolve, 220));
|
||||
await idle();
|
||||
const on = measure();
|
||||
const switchAligned = Math.abs(off.topGap - off.bottomGap) <= 1
|
||||
&& Math.abs(on.topGap - on.bottomGap) <= 1
|
||||
|
||||
Reference in New Issue
Block a user