Testing
Unit tests
Run all workspace tests:
Or test a specific crate:
What's tested
- Hit-testing (cell, column header, row header)
- Column offsets computation
- Cell formatting (all CellFormat variants)
- Data sources (VecDataSource, FnDataSource, PageCacheDataSource)
- Selection model (anchor/focus, copy/paste TSV)
- Search (query matching, limits)
- Undo/redo history
- Sort and filter logic
End-to-end tests (Playwright)
E2E tests verify the grid in a real browser environment.
Setup (one-time)
Run tests
Test structure
Tests are in e2e/tests/grid.spec.ts:
Canvas-specific challenges
The grid renders on <canvas>, not in the DOM. This means:
- No DOM selectors for grid cells
- Interactions use fixed pixel coordinates
- Visual regression compares screenshots pixel-by-pixel
Warning
If you change the layout (header height, row height, gutter width),
update the coordinates in grid.spec.ts.
Update screenshots
After intentional visual changes:
This regenerates the reference screenshots for visual regression tests.