Repository navigation
test(richtext): the code block header tests wait for the copy button's tooltip - #8569
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
CI-Rerun: test-ui (4/4) failed on a rich-text test race on main (CodeBlockHeaderPlugin read a header before its tooltip arrived); meta#8569 fixes it. No change here.
CI-Rerun: test-ui (4/4) failed on a rich-text test race on main (CodeBlockHeaderPlugin read a header before its tooltip arrived); meta#8569 fixes it. No change here.
There was a problem hiding this comment.
Recommended for approval: each of the three code block header tests now waits for the header's full text rather than for the header element, which removes the race with the copy button's tooltip (rendered one commit after the header) while keeping the same expected strings. No changes are needed.
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…s tooltip Three tests read a code block header's text right after it appeared. Since meta#8519 the copy button's tooltip arrives one render later, from its own layer slot, so on a busy runner the read could miss it. Each test now waits for the full text inside waitFor.
b23d154 to
7d01151
Compare
There was a problem hiding this comment.
Recommended for approval: the three code block header tests now wait for each header's full text, including the copy button's tooltip that is drawn one commit after the header, so a slow runner no longer reads a header too early, and the expected strings are unchanged. No changes are needed.
[Automated review]
…ns (#8196) ## User impact Part of making Astryx match iOS, whose progress indicators keep moving while busy. Progress usually arrives while the page is busy, and the fill then freezes and jumps (Chromium, Safari), so the work looks stuck. Now it keeps sliding. ## Problem and solution fit The fill animated `width`, laid out and painted on the main thread every frame, so a busy page stalls it. Options: - Keep `width`: the freeze stays. - `scaleX` on a full-length fill: compositor, but it stretches the round ends. - `translateX` of a full-length fill in a clipping track: compositor, round ends. Costs: a tiny fill's end follows the track's curve; a runtime direction flip sweeps the fill across. This PR takes the third; [cixzhang decided to keep it](#8196 (comment)). ## Expected behavior and authority `component:ProgressBar`'s targets are unchanged; #6248 moved the marks out of the track, so it can clip. Under Reduce Motion a new value lands at once (`design:reduced-motion` DEC-3). ## Smallest restoration `ProgressBar.tsx`: the fill transitions `transform` instead of `width`, on the theme's duration and easing; the track clips; the fill mirrors by its own direction. Forced colors keep the width geometry, so the outline stays whole (`architecture:theme-tokens` INV11). No API change. ## Evidence - iOS simulator, 10 → 90 during a 0.7 s busy script; main (above) freezes at 41%, then jumps:  - Unchanged: an ordinary change, and right to left:   - Small values, before above:  ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing What I ran and what it showed: 1. In the ProgressBar story at 10, this console line (preview frame) sets 90 and blocks the page 0.7 s: `__STORYBOOK_ADDONS_CHANNEL__.emit('updateStoryArgs', {storyId: 'core-progressbar--default', updatedArgs: {value: 90}}); setTimeout(() => { const end = performance.now() + 700; while (performance.now() < end); }, 30);` `main` freezes, then jumps; this PR keeps sliding, with no per-frame layout or paint. iOS simulator: the same (above). 2. Chromium tests: the edge at the value in both directions, a 2% fill following the track's curve, a closed forced-colors outline, and an immediate change under Reduce Motion. The busy-page ones fail on `main`. 3. Local gates at f55c39b: root build, typecheck, ESLint, Prettier, Storybook, the ProgressBar Chromium tests (19) and `pnpm test:ui` pass, apart from failures known elsewhere: the rich-text race #8569 fixes, and #8509 and #8520 in the node project.
Maintainer impact
Found when the Spinner and CircularProgress fixes (#8177, #8232) hit this race in CI. Since #8519,
CodeBlockHeaderPlugin.test.tsxcan fail on a busy CI runner with no rich-text change: a header's text read['ts', 'js']instead of['tsCopy code', 'jsCopy code']on pull requests that touch neither rich text nor layers, which then needed a re-run.Intended invariant
Each code block header shows its language label and a copy button whose tooltip reads "Copy code" (
spec:AST-061FR8). The tests assert that text; product behavior stays as it is.Change
What led to it: a header's text ends with its copy button's tooltip. Since #8519 the tooltip's layer is placed by its own slot one render after the header (the slot gets its mount from a store subscription). Three tests waited for the header to exist, then read its text, so a late slot render left the tooltip out.
Options:
waitFor(this PR): the tests stop assuming one render.This PR takes the first, since the one-render assumption was the tests', not the product's. The first test already finds the button by its accessible name, present from the start, so it is unchanged.
Evidence
useLayer.tsx), the old tests fail as the failing runs did:expected '' to be 'Copy code', and['', 'Plaintext']for['Copy code', 'PlaintextCopy code'].Scope
Testing
What I ran and what it showed:
pnpm exec vitest run --project ui packages/richtext/src/CodeBlockHeaderPlugin.test.tsx: all four tests pass.useLayer.tsxdelayed 30 ms, its value and its listeners both (a temporary edit): main's file fails three of the four tests; this file passes all four.pnpm test:ui(16,446 tests) pass; in the node project, the only failures arecache.test.mjs's two install-lock cases, a known failure on this machine (fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520).