Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest testing not possible with CommentsRepository premium plugin #17420

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stefanseeger
Copy link
Contributor

@stefanseeger stefanseeger commented Nov 7, 2024

Suggested merge commit message (convention)

Docs: Enhance jest testing section to work with CommentsRepository. Closes #17421.


Additional information

📝 Provide a description of requested docs changes

The jest related docs for angular, react and vue are not working when the premium plugin CommentsRepository is used

Error message

FrontEnd\node_modules\@ckeditor\ckeditor5-collaboration-core\dist\index.js:392
    const _0x27ffc6 = _0x20b54e['getClientRects']()['item'](0x0);
                                                           ^

TypeError: _0x20b54e.getClientRects(...).item is not a function
    at R (FrontEnd\node_modules\@ckeditor\ckeditor5-collaboration-core\dist\index.js:392:60)
    at r._getTargetForId (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:176593)     
    at d._target (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:178362)
    at d._getNormalizedTarget (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:54176) 
    at new d (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:52317)
    at o._attachCommentThread (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:137698)
    at ie.attachTo (FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:154306)
    at FrontEnd\node_modules\@ckeditor\ckeditor5-comments\dist\index.js:22:178334
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Fix

Additional mocking for Element.prototype.getClientRects is needed

Mock Element.prototype.getClientRects to make CommentsRepository work in tests
@stefanseeger stefanseeger changed the title Draft: Update jest related md files tot make it work when using CommentsRepository Jest testing not possible with CommentsRepository premium plugin Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest testing not possible with CommentsRepository premium plugin
1 participant