Repository navigation
test(interaction-harness): sampleCurve samples a ::before or ::after - #10052
Conversation
A component that animates a pseudo-element (animatorFor(element, {pseudoElement: '::before'})) drew its motion where sampleCurve could not read it: it labelled samples by the element's own animations only and read the element's computed style. sampleCurve(locator, times, {pseudoElement}) now reads that pseudo-element's presented values, labelled by its own animations (those whose effect targets the element with that pseudo-element). Without the option nothing changes.
waitForRest already waits a pseudo-element's animation out: its read of getAnimations({subtree: true}) includes the element's pseudo-elements in Chromium and WebKit. A self-test now guards that.
Red first: on main's curves.ts the new self-test samples the box itself (opacity 1 at t 0, where the veil's is 0) in both engines; with the option it matches the veil's linear fade to 0.005 and its 40 px move to 0.05 px. The README describes the option in the curve-sampling paragraph, outside the module table.
… call that exists on main
astracat found that the note cited `animatorFor(element, {pseudoElement})`, an animator option that arrives with #8242 and isn't on main. It now names `element.animate(keyframes, {pseudoElement})`, the call the self-test uses.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is a draft; it runs once the pull request is marked ready for review.
The pseudoElement option on sampleCurve reads a ::before or ::after labelled by its own animations, sampling without it is unchanged, and the new self-test fails without the change and passes with it. One optional suggestion is left inline on the new test.
[Automated review]
| {duration: 300, easing: 'linear', pseudoElement: '::before'}, | ||
| ); | ||
| }, VEIL_STYLE); | ||
| await holdAnimations(page, box); |
There was a problem hiding this comment.
Optional: this holds a 300 ms run after it has started. The harness README recommends armHold before the action for short runs, and the two curve-sampling tests above arm first so a busy runner cannot end the run before the hold. A minimal change: const hold = await armHold(page, box); before the box.evaluate(...) call, then await hold.held(); here.
Supersedes #8911 by @vjeux: his two commits, cherry-picked onto today's
mainunchanged, with his authorship. Test infrastructure only (internal/interaction-harness); no library code, so there is no changeset.Why
A component that animates a
::beforeor::after(element.animate(keyframes, {pseudoElement})) draws its motion wheresampleCurvecannot read it.sampleCurvereads the element's computed style, labelled by the element's own animations.Change
sampleCurve(locator, times, {pseudoElement: '::before'})reads that pseudo-element's presented values. They are labelled by its own animations: those whose effect targets the element with that pseudo-element. Without the option, nothing changes.waitForRestalready waits out a pseudo-element's animation, because its subtree read includes the element's pseudo-elements, and a self-test now guards that. The README describes the option in its curve-sampling paragraph.Evidence
main'scurves.ts, the newsampleCurveself-test samples the box itself and fails: opacity 1 at t 0, where the veil's opacity is 0. ThewaitForRestguard passes onmainas intended. Real Chromium.check:changesetspass.