Skip to content

Write unit tests for mapping features #57

@DikieDick

Description

@DikieDick

The features on the mapping branch can and should be unit tested.

Text insertions are tested, but maybe need to be extended to check particular cases, check line nr updates, etc. (see impermeable/waterproof-editor/__tests__/mapping/textupdate.test.ts)

Node insertions and deletions are not well tested at all. I've written two that show how to construct ProseMirror steps and how we can test against these (see impermeable/waterproof-editor/__tests__/mapping/nodeupdate.test.ts).

One way of obtaining more of these steps is to use the node insertions inside the editor and log the step that is applied by ProseMirror as follows (file: impermeable/waterproof-editor/src/editor.ts)

...
for (step of tr.steps) {
+ console.log(step);
  if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep) {
  ...			

If more information is needed, please let me know.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions