telerik / kendo-angular

Issue tracker - Kendo UI for Angular
http://www.telerik.com/kendo-angular-ui/
Other
468 stars 217 forks source link

clash when trying to use jest-prosemirror testing lib #3742

Closed nadavsinai-philips closed 2 years ago

nadavsinai-philips commented 2 years ago

We want to use the very common and very useful jest-prosemirror testing library to test plugins we develop this allows to quickly create editors and use custom matchers which compare documents etc.

Due to your modified prosemirror-tables package - prosemirror-tables-ts - which is used by @progres/kendo-angular-editor inplace of prosemirror-tables a fatal error is thrown just by importing your lib and jest-prosemirror in the same file

    RangeError: Duplicate use of selection JSON ID cell

the reason is that in line 283 of prosemirror-tables there is the following side-effect

Selection.jsonID('cell', CellSelection);

this modified the state of the (shared) prosemirror-state Selection class which throws when the 2nd call arrives on the same ID

To Reproduce Steps to reproduce the behavior:


import {schema} from @progres/kendo-angular-editor'
import {doc,p,createEditor} from 'jest-prosemirror'

(really any code that imports from both libraries)

Expected behavior ability to test with jest-prosemirror as the rest of the community

Browser

nadavsinai-philips commented 2 years ago

@yanmariomenev any comment on this ?

dtopalov commented 2 years ago

The custom prosemirror-tables-ts package is no longer in use and we reverted to prosemirror-tables in v. 1.9.2 of the @progress/kendo-editor-common package. Latest versions of the @progress/kendo-angular-editor package already use the updated common package too.