draft: suggestion / diffing tests#2799
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
^ added the latest changes which update to latest @y/prosemirror & moves modification CSS to core for modification rendering |
… into y-prosemirror-tests
6753eb1 to
68ff75c
Compare
68ff75c to
6753eb1
Compare
…write Trailing block is now a widget decoration (#2733) rather than a real node, so replaceBlocks no longer leaves a trailing paragraph in the Y.Doc. Regenerate the affected baseDoc/suggestionDoc/editorHtml inline snapshots and screenshots to drop the stale trailing blockContainer. Re-enable two concurrent tests that now converge instead of throwing 'applyChangesetToDelta: Unexpected case' (nesting indent cascade, table delete-column vs add-row). Mark 'delete image block' as test.fails: deleting a sole atom block in suggestion mode produces a blockContainer with two blockContent children via the @y/y attribution diff, violating the schema until upstream can represent it.
ydocXml() used Y.XmlFragment.toString(), which only serialises element/text structure, so base vs suggestion snapshots came out identical even when inline marks differed. Walk the deep delta (toDeltaDeep) instead so per-run format marks render as nested tags (<bold>world</bold>) and attribution surfaces as an attribute, and attrs/urls are properly XML-escaped. Marks are sorted for deterministic nesting across concurrent merges.
Aliases the CSS subpath to packages/core/src/style.css so editor styles track source like the JS does, instead of resolving to a potentially stale dist/style.css. This was hiding the suggestion-mode highlight in the add-bold screenshot, now regenerated.
…apture timeout Now that browser tests load @blocknote/core/style.css from source, the suggestion-highlight CSS ([data-type=modification], ins/del) renders in the baselines. Regenerate all affected y-prosemirror screenshots so they show the blue suggestion markers (e.g. remove-bold, add-italic-to-bold). Also bump toMatchScreenshot timeout to 15s: heavier renders (tables, nested/concurrent) were intermittently failing with 'Could not capture a stable screenshot within 5000ms'. Drops the orphaned concurrent-both-add-children baseline (no active test references it).
The TODO claimed y-attributed-format has no toDOM / visual marker. It does (SuggestionMarks.ts renders a <span data-type="modification"> that the editor CSS highlights), as the regenerated screenshot now shows.
|
OK, so it looks like you were just not running with Before this, I updated to the latest y/prosemirror so we can check with the new y/prosemirror replacement algo. This fixed a couple of broken tests so I re-enabled them. Screenshots & tests should be accurate now. |
This draft PR adds visual testing for a large number of diffing scenarios outlined here
The goal is two-fold:
a) Serve as an overview of how far we are with implementing the UX / handling edge-cases
b) prevent regressions going forward
Todo:
[ ] integrate with CI
[ ] I think after the latest update to y-prosemirror, more tests are failing than before (try re-running the tests now)