Repository navigation
test: match inlined svg icons regardless of whitespace and quotes - #24
Merged
Merged
Conversation
LikeC4 inlines local SVG icons as data: URIs, and the encoder collapses whitespace and swaps double quotes for single. The smoke check compared the raw first 60 characters of the file, which only matched because the playground's demo.svg has no line break near its start. Strip whitespace and quotes on both sides before comparing.
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.
What
scripts/smoke.ts—rendered()now strips whitespace and quotes from both the icon file and the decodeddata:URI before comparing (first 120 normalised characters).Why
LikeC4 inlines local SVG icons as
data:image/svg+xmlURIs, and the encoder collapses whitespace and swaps"for'. The old check compared the raw first 60 characters of the file, which only worked because the playground'sdemo.svghas no line break near its start. An icon that opens with<?xml …?>followed by a newline (or an indented comment) renders correctly but fails the check.Found while upgrading a consuming site to
1.0.0-prerelease.8: its own copy of this check reported a self-hosted icon as missing, though a browser showed it on every node.Changes
Test-only. No change to the package, so no version bump.
Verification
bunx tsc -p tsconfig.scripts.json --noEmitbun run build, thenbun scripts/smoke.tsagainst the built playground — passes, including the self-hostedpublic/icon and the/_astroc4/aliased icon.