Files
computer-playbook/scripts/tests/design
kevinveenbirkenbachandClaude Opus 5.5 d0648baaf4 test(design): measure contrast in both modes, fail on unmatched selectors
The shared design helper gains tokenValue, assertToken and
assertLightAndDark. assertToken polls the computed property of an
element until it equals the value of a token. assertLightAndDark
demands that the surface behind an element is darker in dark mode than
in light mode.

assertReadable switches CSS transitions off, waits two frames and the
finite animations per mode, reads every color back from a canvas pixel,
so any CSS color syntax is measured, and blends a translucent text color
with its background. A selector that matches nothing visible fails
unless it is passed as { selector, optional: true }, and a call that
measured no element fails.

make design-gallery runs the design tests without retries, so a failing
test is reported after one attempt.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 21:54:04 +02:00
..