[P1] Build a cross-browser component contract test matrix and coverage baseline
Objective
Turn the library's public behavior into executable contracts across all packages and supported browsers.
Evidence
- Only 5 of 25 Material packages contain test files.
- Root tests currently fail before useful execution in the local allowed Node environment.
- Existing tests are package-local and do not establish a coverage floor, browser matrix, accessibility baseline, or form/package integration tests.
Scope
- Create reusable Lit component test helpers and a shared Web Test Runner/Playwright browser matrix.
- Cover rendering/defaults, property/attribute reflection, disabled states, events, slots, focus/keyboard, ARIA, cleanup, and public methods for every package.
- Add coverage reporting and ratcheted thresholds (start honest, increase deliberately).
- Add consumer-level integration fixtures for form controls and composite widgets.
- Publish artifacts/summaries in CI.
Acceptance criteria
- [ ] Every public package has meaningful tests for its documented API.
- [ ] Tests run on Chromium, Firefox, and WebKit or the documented supported subset.
- [ ] Coverage is reported with an enforced baseline and no package at 0% behavioral coverage.
- [ ] Event tests assert bubbling, composition, cancelability, and detail shape.
- [ ] Listener/timer cleanup is covered for components that attach global resources.
- [ ] Flaky timing is removed or controlled with deterministic helpers.
Dependencies
Blocked by the shared toolchain and PR CI. Component-correctness issues should add their own regression tests and feed this matrix.
Autonomous execution contract
Prefer behavior contracts over snapshots. Land in component-family batches if the final PR would be too large.
Toolchain/CI prerequisites now include a protected three-browser Vitest matrix. This P1 issue is released to expand it into the repository-wide executable contract/coverage baseline. Land in focused component-family batches where needed; do not duplicate existing P0/P1 behavior tests or add compatibility shims.
Batch 1 is now in PR #86: navigation bar and navigation rail only. It adds reusable Lit browser-contract helpers, three-browser deterministic layout/event/cleanup contracts, and a 100% Istanbul coverage ratchet for those two packages.
Boundary: forms, dialog, menu, radio, tabs, and tooltip contracts remain untouched; the still-untested public packages are not represented as covered.
Follow-up: land further focused families (for example button/chip/badge, then input controls) and ratchet each package only after all of its production source is exercised across Chromium, Firefox, and WebKit.
Validation note: the batch tests and coverage gate pass. Repository-wide pnpm test remains blocked by an existing WebKit-only m3-menu real-Tab focus assertion (activeElement is body rather than the expected next button); PR #86 does not alter that already-merged menu contract.
Merged the navigation-family first batch in #86: reusable browser helpers, three-engine contracts, 100% per-package coverage ratchets, and event-shape assertions. #12 remains open for the next component-family batch; no repository-wide completion claim is being made.