test(theme): assert keyframes registration for animation recipes#300
Merged
Conversation
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.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the systemic gap in SF-3: recipes that register
@keyframesin theirsetup()callback had no unit test asserting the registration. Because a recipe references keyframes indirectly — a stringanimationNameinbase/variants — that string is opaque to the base/variant object assertions. Delete the matchings.keyframes(...)call and the animation silently goes inert; nothing red catches it.expectKeyframesRegistered(s, name)helper (theme/src/__tests__/expectKeyframesRegistered.ts) that scanss.root.childrenfor the@keyframes <name>at-rule and returns it, with its own colocated test covering the found and not-found paths.progress-bar— 8 keyframes (the registrations live onuseProgressBarRecipe, notuseProgressRecipe— the exact asymmetry that makes this bug easy to miss).skeleton—skeleton-pulse.spinner-circle—spinner-rotate+spinner-dash.recipe-craftso 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 nouseToastProgressRecipe.test.tsto 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 test→ 3273 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
expectKeyframesRegisteredhelper has a colocated test that fails when the named keyframes are absent