test(superdoc): raise package coverage to 90%#2836
Conversation
Adds test coverage for previously untested files: - core/pdf/pdf-adapter.js — factory, adapter, CDN worker helper - components/CommentsLayer/use-conversation.js — conversation composable - components/CommentsLayer/use-floating-comment.js — floating comment state - components/CommentsLayer/CommentGroup.vue — grouped comment rendering - components/PdfViewer/PdfViewer.vue — top-level viewer with adapter mocks - components/PdfViewer/PdfViewerDocument.vue — page list wrapper - components/PdfViewer/PdfViewerPage.vue — page render + text layer 62 new tests. Lifts filtered coverage from 78.6% to 81.1%.
- composables/use-field.js — useField + sub-handlers (SELECT/IMAGE/CHECKBOX) - composables/use-ai.js — AI writer cursor positioning, fallbacks, tool click - components/CommentsLayer/commentsList/super-comments-list.js — Vue app lifecycle - components/Whiteboard/use-whiteboard.js — event wiring, page ready, teardown 46 new tests. Lifts filtered coverage 81.1% → 83.3%.
Mock Konva Stage/Layer/Line/Text/Image/Transformer and trigger stage/text-node event listeners to exercise the interactive code paths: draw/erase flows, stage click handlers (text + select), text node selection + drag + Delete, image node events. 38 tests. Lifts WhiteboardPage coverage 40% → 81%, package 83.3% → 88.5%.
The word-diff executor added in #2817 calls `tr.doc.textBetween(...)` and `tr.doc.nodesBetween(...)` in the text.rewrite path, but the `tr.doc` mocks in determinism-stress, executor, and preview-parity tests were never updated to match. That broke determinism-stress, executeCompiledPlan, previewPlan, and revision-drift-guard tests on main with `TypeError: tr.doc.textBetween is not a function` / `doc.nodesBetween is not a function`.
Add targeted tests to close remaining gaps: - use-comment extended — resolveComment, setIsInternal, setText, mentions - superdoc-store extended — reset, getDocument, handlePageReady, getPageBounds, areDocumentsReady, setExceptionHandler, collaboration mode - Whiteboard extended — tool/enabled propagation, opacity clamping, callbacks - New small files: comment-schemas, DocumentUsers.vue, SuperToolbar.vue, use-selection, CommentsLayer/helpers formatDate Lifts package coverage from 83.3% to 90.1%.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a34649971e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| document.body.appendChild(container); | ||
| page.mount(container); |
There was a problem hiding this comment.
Add teardown for mounted WhiteboardPage instances
This helper mounts WhiteboardPage instances but never destroys them, and WhiteboardPage.mount() registers a global window keydown listener that is only removed by destroy(). Because this file mounts many pages and also dispatches Delete key events, stale listeners from earlier tests can keep firing against old page state, creating order-dependent/flaky behavior and hidden side effects across tests; adding per-test cleanup (page.destroy() and DOM removal) will keep the suite isolated.
Useful? React with 👍 / 👎.
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.16 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.19 |
|
🎉 This PR is included in template-builder v1.5.0-next.19 The release is available on GitHub release |
|
🎉 This PR is included in esign v2.3.0-next.19 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.26.0-next.19 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.7.0-next.20 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.6.0-next.17 |
|
🎉 This PR is included in superdoc-cli v0.7.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.27.0 The release is available on GitHub release |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.6.0 |
|
🎉 This PR is included in vscode-ext v2.3.0 |
Adds tests for parts of the SuperDoc package that weren't covered before. Test coverage goes from 78.6% to 90.1%, hitting the 90% target set up by #2831.
New tests cover:
No changes to shipped code — tests only.