Skip to content

draft: suggestion / diffing tests#2799

Open
YousefED wants to merge 16 commits into
y-prosemirror-v14from
y-prosemirror-tests
Open

draft: suggestion / diffing tests#2799
YousefED wants to merge 16 commits into
y-prosemirror-v14from
y-prosemirror-tests

Conversation

@YousefED
Copy link
Copy Markdown
Collaborator

@YousefED YousefED commented May 28, 2026

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)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview Jun 5, 2026 3:36pm
blocknote-website Error Error Jun 5, 2026 3:36pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cce399ca-13ca-4d4e-8aec-0c6b50857005

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch y-prosemirror-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nperez0111
Copy link
Copy Markdown
Contributor

^ added the latest changes which update to latest @y/prosemirror & moves modification CSS to core for modification rendering

…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.
@nperez0111
Copy link
Copy Markdown
Contributor

OK, so it looks like you were just not running with pnpm run build & using something which did not have the modification css that I had added. I made vitest pull the css from source so this should not happen. I also regenerated all of the screenshots now that they can have more CSS to them.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants