Skip to content

test(interaction-harness): sampleCurve samples a ::before or ::after - #10052

Merged
cixzhang merged 2 commits into
mainfrom
lane4/sample-curve-pseudo
Nov 5, 2026
Merged

cixzhang merged 2 commits into
mainfrom
lane4/sample-curve-pseudo

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Supersedes #8911 by @vjeux: his two commits, cherry-picked onto today's main unchanged, with his authorship. Test infrastructure only (internal/interaction-harness); no library code, so there is no changeset.

Why

A component that animates a ::before or ::after (element.animate(keyframes, {pseudoElement})) draws its motion where sampleCurve cannot read it. sampleCurve reads 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. waitForRest already 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

  • Red first: with main's curves.ts, the new sampleCurve self-test samples the box itself and fails: opacity 1 at t 0, where the veil's opacity is 0. The waitForRest guard passes on main as intended. Real Chromium.
  • With the option: it matches the veil's linear fade to within 0.005 and its 40 px move to within 0.05 px.
  • No regressions: the whole harness self-test file passes in Chromium (122 passed, 4 skipped).
  • Checks: the harness typecheck, ESLint, Prettier and check:changesets pass.

vjeux added 2 commits November 4, 2026 22:26
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.
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 6:38am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 6:45 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 5b77fd6

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 9 rows, core 4 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 06:49
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 5, 2026
@cixzhang
cixzhang marked this pull request as draft November 5, 2026 06:54
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 06:54
@cixzhang
cixzhang merged commit 6fc2bff into main Nov 5, 2026
149 of 171 checks passed
@cixzhang
cixzhang deleted the lane4/sample-curve-pseudo branch November 6, 2026 02:01

This branch was successfully deployed

1 active deployment
Preview — 5b77fd6d Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants