chore(meter): add vrt coverage - #6576
Conversation
Adds dedicated Storybook VRT stories for swc-meter, following the button/action-button VRT foundation: size, variant, label-position, value-state (including over-100% and anatomy/label variations), behaviors, wrapping, CJK, and static-color permutations plus a forced-colors snapshot in meter.vrt.ts, and one reference/override row per public --swc-linear-progress-* custom property in meter-custom-properties.vrt.ts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
📚 Branch Preview Links🔍 Gen1 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
| [ | ||
| renderMeter({ | ||
| label: | ||
| 'A label long enough to wrap onto multiple lines within the available inline space', |
There was a problem hiding this comment.
Fixed in ba1f188 — constrained the meter to max-inline-size: 200px for this case so the label actually wraps onto multiple lines in the snapshot now.
| // `forced-colors` replaces the whole page palette, so it can't be scoped to | ||
| // a subtree the way theme()'s light/dark split is, and needs its own | ||
| // snapshot rather than folding into Permutations. Confirms the | ||
| // `@media (forced-colors: active)` override in linear-progress-base.css | ||
| // (ButtonFace track, ButtonText fill) applies regardless of variant or | ||
| // static-color. |
There was a problem hiding this comment.
I don't think this comment is adding much value in its current state. How would you feel about removing it?
| // Rendered once in light/ltr and once in dark/rtl (that combination covers | ||
| // both axes), all still in a single story so it costs one snapshot. |
There was a problem hiding this comment.
I don't know that this comment is adding much value in its current state. How would you feel about removing it?
pfulton
left a comment
There was a problem hiding this comment.
I left a few comments here, @Rajdeepc. I'll leave it to your judgement as to whether you keep or get rid of the AI-generated comments that I left feedback on. For the wrapping label example, if you're able to get that one to actually wrap in the snapshot, that would be valuable.
|
Can we adjust the color from magenta, to something easier to view? The contrast fails:https://webaim.org/resources/contrastchecker/
|
miwha-adobe
left a comment
There was a problem hiding this comment.
Please see comment about color contrast above
- Constrain the Wrapping case's width so the label actually wraps in the snapshot instead of fitting on one line (pfulton). - Drop two low-value comments above Permutations/ForcedColors (pfulton). - Swap the --swc-linear-progress-text-color override from magenta to darkmagenta: magenta text fails WCAG contrast on the default light background and was flagged by axe (miwha-adobe). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@miwha-adobe Thanks for catching that! Fixed in ba1f188 — swapped `--swc-linear-progress-text-color`'s override from `magenta` to `darkmagenta` (~7.5:1 contrast on the default light background vs. magenta's ~2.3:1), so it now passes WCAG AA while still rendering obviously different from the default. Left `fill-color`/`track-color` as `magenta` since those aren't text colors and aren't subject to the same contrast check. |
|
|
||
| const MOD_PROPERTY_CASES: readonly MeterPropertyCase[] = [ | ||
| { property: '--swc-linear-progress-fill-color', value: 'magenta' }, | ||
| { property: '--swc-linear-progress-track-color', value: 'magenta' }, |
There was a problem hiding this comment.
What if we go, deep-plum instead for all three of these? I checked out deep-magenta, and it still fails for the fill (though the text is great and has the 7:5:1 like you said against white).
Also I don't know that the comment is necessarily needed and or can be condensed. I feel like claude tends to over explain in it's comments.



Description
Adds dedicated Storybook VRT coverage for
swc-meter, following the foundation established in the button/action-button VRT work:2nd-gen/packages/swc/components/meter/test/vrt/meter.vrt.ts—PermutationsandForcedColorsstories covering every size, every variant, both label positions, value states (0/25/50/75/100%, plus an over-100% case with a clamped bar and an overriddenvalue-label), full anatomy (label-only, label + description, accessible-label-only fallback, custom value text), behaviors (custom range, format options), text wrapping, CJK language rendering, and static colors on their contrast backgrounds.2nd-gen/packages/swc/components/meter/test/vrt/meter-custom-properties.vrt.ts— one reference/override row per each of the 6 documented--swc-linear-progress-*custom properties, with coverage verified against the generated custom-elements manifest.No
meter-global-styles.vrt.tswas added: unlike button, there is no generated global stylesheet for meter/linear-progress to cover. Meter is also non-focusable and read-only, so unlike button/action-button/accordion there are no:hover/:focus-visible/:activerules to force in a VRT snapshot.Motivation and context
Meter currently has no dedicated visual regression coverage. Chromatic VRT catches rendering regressions (color, layout, forced-colors/high-contrast) that unit tests can't, and this closes that gap for meter the same way #6463 and #6569 did for button and action-button.
Related issue(s)
Screenshots (if appropriate)
N/A — new Chromatic snapshots will be generated on this PR's first VRT run for review.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Meter VRT stories render as expected
yarn storybook) in2nd-gen/packages/swcButtonFace/ButtonTexttrack and fill overrides, and each custom-property override cell visibly differs from its reference cellChromatic snapshots are accurate