fix(test): update tracked-replace assertion to match word-diff behavior#2851
Merged
Conversation
PR #2817 added word-level diffing so multi-word tracked replacements fragment into per-word insert/delete pairs β "a tracked style" β "new fancy" becomes two tracked changes ("a" β "new" around a preserved space, then "tracked style" β "fancy"). The `getDocumentText()` assertion in programmatic-tracked-change.spec.ts still expected the pre-word-diff behaviour where "new fancy" appeared as one contiguous string, which produced this on all three browsers: Expected substring: "new fancy" Received string: "Here is anew tracked stylefancy change" Assert the inserted words "new" and "fancy" each appear in the document text instead, and leave a comment explaining the new semantics so the next reader doesn't have to retrace this. Ran tests/comments/programmatic-tracked-change.spec.ts in chromium locally β all 5 cases pass.
caio-pizzol
enabled auto-merge
April 16, 2026 19:55
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
caio-pizzol
added this pull request to the merge queue
Apr 16, 2026
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.
The `tracked replace via document-api` behavior test has been red on main across all three browsers since #2817 (word-level diffing) landed. Word-diff intentionally fragments multi-word tracked replacements into per-word insert/delete pairs, so "new fancy" is no longer a contiguous substring in the document β the test just wasn't updated alongside the feature.
Rejected: changing word-diff itself (splits multi-word replacements on purpose for granular tracked changes β behaviour feels right, test was stale).