[PRO-858] Theme API: data-driven E2E expectations per theme (design tokens) by qunabu · Pull Request #12239 · handsontable/handsontable

and others added 4 commits

March 30, 2026 14:04
- Add figma token conversion tool at handsontable/src/themes/figma/
- Store design tokens JSON as tokens.json (single source of truth)
- Tool outputs CSS and JS variable files directly to src/themes/static/
- Add npm script: npm run build:design-tokens
- Use .mjs extensions for ES module support within CommonJS package
- Absolute paths via import.meta.url for CWD-independent execution

Workflow: Export tokens from Figma → save as tokens.json → run build:design-tokens

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- New test helper: designTokens.js resolves token references to numeric px values
- Exported functions: token(), tokenForThemes(), getTokenValue(),
  calcRowHeight(), calcColHeaderHeight(), forAllThemes()
- Token resolution chain: tokens → density → sizing → px value
- Registered as global test helper via test/helpers/index.js

Enables tests to calculate expected dimensions from design tokens
instead of using hardcoded magic numbers per theme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tests

Convert .forThemes blocks in 16 test/e2e spec files to calculate expected
dimensions from design tokens instead of using magic numbers.

Formulas: calcRowHeight(t), calcColHeaderHeight(t), forAllThemes()
- Row height = lineHeight + (cellVerticalPadding * 2) + 1px border
- Col header height = lineHeight + (cellVerticalPadding * 2)

Files converted:
- fixedRowsBottom, fixedRowsTop, scrollToFocusedCell, scrollViewportTo
- viewportScroll, refreshDimensions, batch, getRowHeight
- ColHeader, Core_view, Core_resize, Core_reCreate
- beforeViewportScrollVertically, modifyRowHeightByOverlayName
- beforeRefreshDimensions, afterRefreshDimensions

Note: 65 plugin spec files remain to be converted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extend designTokens with token resolution and calcE2e* helpers
- Allow E2E bundle to import theme sizing/density/token modules (babel)
- Update E2E and plugin specs for classic, main, and horizon themes

Made-with: Cursor

@qunabu

@qunabu qunabu marked this pull request as ready for review

March 31, 2026 09:14

cursor[bot]

@qunabu qunabu marked this pull request as draft

April 2, 2026 08:07