Overview
Pair with Editor → Testing strategies. Add WASM-specific checks for call counts, memory on large paste, and async ordering.
End-to-end tests
Drive real browsers (Playwright, Cypress) against your production bundle including WASM. Verify lazy-loaded modules actually load on first editor focus. Snapshot DOM sparingly—prefer assertions on model state exported for tests.
Profiling the boundary
Use the Performance panel: separate time in JS glue, WASM execution, and rendering. If glue dominates, reduce string copies or batch calls ( JS ↔ WASM boundary).
IME & paste in CI
Headless browsers often differ from macOS/Windows IME. Maintain a matrix of manual or device-farm tests for CJK input and mobile keyboards; automate plain-text paths in CI.
Flaky tests frequently come from timing between async WASM and input events—use explicit awaits and stable selectors.
Determinism & seeds
For CRDT or randomized fuzzing, fix seeds in Rust tests; for web, record minimal repro sequences (ops lists) to attach to bug reports.
Wasm guides
Editing approaches
contenteditable + WASM: source of truth, event order, DOM↔model loop, normalization, and when to call Rust.
IME & composition
composition events, syncing a Rust document model, and why the browser still owns the IME.
JS ↔ WASM boundary
Strings, copies, batched ops, async vs input events, and keeping the hot path cheap.
Clipboard & input routing
beforeinput, paste, routing decisions in JS vs sanitization in WASM.
Tooling, bundle & workers
wasm-pack, wasm-opt, code splitting, Web Workers, COOP/COEP and threads.
Collaboration & CRDT (WASM)
Yrs/y-crdt, bridging to Yjs, snapshots vs update streams with an editor host.
Selection, Range & offsets
UTF-16 vs UTF-8 indices, Selection/Range in JS, mapping to a Rust model and getTargetRanges.
Undo & redo model
Browser undo stack vs model history, programmatic DOM, and WASM-hosted transactions.
Accessibility (WASM host)
Roles, focus, screen readers when the editable surface is still the browser.
Security & deployment
CSP, SRI, module integrity, and hosting WASM next to contenteditable.