Skip to content

test(theme): assert keyframes registration for animation recipes#300

Merged
alexgrozav merged 2 commits into
mainfrom
agent/etoile/335a4ce8
Jul 12, 2026
Merged

test(theme): assert keyframes registration for animation recipes#300
alexgrozav merged 2 commits into
mainfrom
agent/etoile/335a4ce8

Conversation

@alexgrozav

@alexgrozav alexgrozav commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the systemic gap in SF-3: recipes that register @keyframes in their setup() callback had no unit test asserting the registration. Because a recipe references keyframes indirectly — a string animationName in base/variants — that string is opaque to the base/variant object assertions. Delete the matching s.keyframes(...) call and the animation silently goes inert; nothing red catches it.

  • Adds a shared expectKeyframesRegistered(s, name) helper (theme/src/__tests__/expectKeyframesRegistered.ts) that scans s.root.children for the @keyframes <name> at-rule and returns it, with its own colocated test covering the found and not-found paths.
  • Backfills the whole current defect class, not just the two originally flagged:
    • progress-bar — 8 keyframes (the registrations live on useProgressBarRecipe, not useProgressRecipe — the exact asymmetry that makes this bug easy to miss).
    • skeletonskeleton-pulse.
    • spinner-circlespinner-rotate + spinner-dash.
  • Documents the convention in recipe-craft so any future keyframe recipe must assert its registrations.

Note: the toast recipe from the original review (PR #289) is not in main, so there is no useToastProgressRecipe.test.ts to backfill yet — the helper + convention are in place for it to land against.

Scope

Test-only + a test-only helper (not exported from the package index) + one skill convention line. No shipped behavior changes and no public API surface — no changeset required.

Verification

  • pnpm --filter @styleframe/theme test3273 passed (295 files). Confirmed the progress assertion fails red when pointed at the wrong recipe, then passes once corrected — the test can fail.
  • pnpm --filter @styleframe/theme typecheck → clean.
  • oxlint (changed dirs) + oxfmt --check → clean.

Test plan

  • New expectKeyframesRegistered helper has a colocated test that fails when the named keyframes are absent
  • progress / skeleton / spinner recipe tests assert every registered keyframe
  • theme suite green, typecheck clean, lint + format clean

Recipes reference @Keyframes indirectly by a string animationName, which is
opaque to the base/variant object assertions — so a deleted s.keyframes(...)
call silently makes the animation inert and nothing red catches it.

Add a shared expectKeyframesRegistered(s, name) helper that scans
s.root.children for the matching at-rule, and backfill the whole current
defect class: progress-bar (8 keyframes), skeleton (1), spinner-circle (2).
Also document the convention in recipe-craft so future keyframe recipes
must assert their registrations.
@changeset-bot

changeset-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c0a62cd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
storybook-styleframe-dev Ready Ready Preview, Comment Jul 12, 2026 3:33pm
styleframe-dev Ready Ready Preview, Comment Jul 12, 2026 3:33pm

Request Review

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Move expectKeyframesRegistered from theme/src/testing/ to theme/src/__tests__/
per review, fix the three recipe-test import paths, and update the
recipe-craft convention reference.
@alexgrozav alexgrozav merged commit d6dbb04 into main Jul 12, 2026
15 checks passed
@alexgrozav alexgrozav deleted the agent/etoile/335a4ce8 branch July 12, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant