Add unit tests to increase coverage for plugins and editor-adapter#3378
Open
JiuqingSong wants to merge 1 commit into
Open
Add unit tests to increase coverage for plugins and editor-adapter#3378JiuqingSong wants to merge 1 commit into
JiuqingSong wants to merge 1 commit into
Conversation
|
Cover previously-untested code paths: - ContextMenuPluginBase, TouchPlugin (new test files) - CustomReplacePlugin guard branches and replacement callback - TableEditPlugin onMouseMove/ensureTableRects/defaultTableSelector - TableEditor editing lifecycle, public methods, getOnMouseOut, RTL - EditorAdapter API surface (new describe block) - buildRangeEx and insertNode utils (new test files) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aaa12c1 to
eeeeb6b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add unit tests to cover code paths that previously had no test coverage, with no production code changes. A full Istanbul coverage pass confirmed these files/branches were either untested or had zero-hit paths; the additions close those gaps.
ContextMenuPluginBase— new test file (was untested): event handling, container init/reuse,onDismiss, dispose.TouchPlugin— new test file (was untested):pointerDowndetection timer, word-boundary snapping,doubleClickpunctuation/space/word selection, dispose.CustomReplacePlugin— added guard-branch coverage and actually exercised theformatTextSegmentBeforeSelectionMarkercallback (match vs no-match,canUndoByBackspace).TableEditPlugin— addedonMouseMove/ensureTableRects/defaultTableSelectorcoverage (rect hit/miss, caching, editor forwarding).TableEditor— added editing-lifecycle handlers (onFinishEditing,onStart*,onEnd*,onAfterInsert,onBeforeEditTable), publicisEditing/isOwnedElement/onSelect,getOnMouseOut, and RTL coverage.EditorAdapter— new "API coverage" describe block for the public surface (addDomEventHandler, selection getters,getContent,setZoomScale, node manipulation, custom data, dom attributes, undo state, content-edit features,runAsync, etc.).buildRangeExandinsertNodeutils — new test files (were untested), covering every input/branch.How to test
These are test-only changes, so there is no runtime behavior to verify manually.
Before:

After:
