Skip to content

test(theme): move style contracts to Vitest Browser Mode - #652

Merged
IzumiSy merged 3 commits into
docs/semantic-color-palette-contrastfrom
test/browser-style-contracts
Oct 28, 2026
Merged

IzumiSy merged 3 commits into
docs/semantic-color-palette-contrastfrom
test/browser-style-contracts

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Motivation

Stacked on #641, with docs/semantic-color-palette-contrast as the base branch.

The existing contrast tests interpret theme CSS with a handwritten parser, while component snapshots only record class names. Neither proves that the published styles resolve correctly when combined with consumer utilities. Move CSS-dependent checks into a real browser without losing the existing palette, contrast or compatibility guarantees.

Design Decision

Let the browser resolve CSS

Use Vitest Browser Mode with Chromium and the public built stylesheet entrypoint. This exercises variable resolution, inheritance and cascade instead of maintaining a partial CSS engine in the tests. Canvas handles colour parsing and alpha compositing; contrast sampling remains limited to flat backgrounds at 8-bit precision.

Keep structural checks fast

Retain bridge completeness, alias reference chains and all-role typography declaration checks in the Node-based suite. Replace the modifier-only compile checks with computed-style assertions. Existing contrast thresholds and documented exclusions are unchanged.

Summary

  • Migrate the full contrast matrix, legacy alias checks and pinned default colours to browser tests, removing the custom CSS parser.
  • Check published component and consumer styles across all three palettes and both modes, including typography modifiers, token overrides and nested dark mode.
  • Run the browser suite in package CI, exclude duplicated build-output tests from the unit suite, and update the local quality-check procedure.

@IzumiSy

IzumiSy commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix CI errors

Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>

Copilot AI commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@copilot fix CI errors

Fixed in 1937da4. The workspace type-check, lint, unit tests, declaration checks, browser suite, and formatting pass locally. The latest GitHub Actions runs are marked action_required, so they have not run yet.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (1411958) #652 (240f7f6) +/-
Coverage 89.4% 89.4% 0.0%
Test Execution Time 2m15s 2m36s +21s
Details
  |                     | main (1411958) | #652 (240f7f6) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          89.4% |          89.4% | 0.0% |
  |   Files             |            234 |            234 |    0 |
  |   Lines             |           7308 |           7308 |    0 |
  |   Covered           |           6540 |           6540 |    0 |
- | Test Execution Time |          2m15s |          2m36s | +21s |

Code coverage of files in pull request scope (100.0% → 100.0%)

Files Coverage +/- Status
packages/core/package.json 100.0% 0.0% modified

Reported by octocov

@IzumiSy

IzumiSy commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…rast' into test/browser-style-contracts

# Conflicts:
#	packages/core/package.json
#	pnpm-lock.yaml

Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>

Copilot AI commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved and merged the PR base in 3a7001e.

@IzumiSy
IzumiSy marked this pull request as ready for review October 28, 2026 02:34
@IzumiSy
IzumiSy requested a review from a team as a code owner October 28, 2026 02:34
@IzumiSy
IzumiSy merged commit 3feac2f into docs/semantic-color-palette-contrast Oct 28, 2026
6 checks passed
@IzumiSy
IzumiSy deleted the test/browser-style-contracts branch October 28, 2026 02:44
wemra3 pushed a commit that referenced this pull request Oct 28, 2026
The contrast checks moved to Vitest Browser Mode in #652. Update the styling
guide and the decision record, and record why the checks run in Chromium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wemra3 added a commit that referenced this pull request Oct 28, 2026
* docs(theme): state contrast thresholds and check every palette

Status colours stay the same in every palette, and --accent, the chart
colours, the shadows and DocumentProgressCard keep literal values. The
styling guide states the 4.5:1 text and 3:1 non-text thresholds with the
known exceptions, and semantic-contrast.test.ts runs for cream and bloom
as well as default. No colour values change.

Refs tailor-inc/platform-planning#2208, tailor-inc/platform-planning#1892

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(theme): move style contracts to Vitest Browser Mode (#652)

* test(theme): move style contracts to Vitest Browser Mode

* fix CI for browser style contracts

Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>

* docs(theme): describe the browser contrast tests

The contrast checks moved to Vitest Browser Mode in #652. Update the styling
guide and the decision record, and record why the checks run in Chromium.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Hiroki Uemura <hiroki_uemurapartners.tailor.tech@Hirokis-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Seiya IZUMI <IzumiSy@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>
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.

2 participants