Skip to content

Commit 29c1a7a

Browse files
authored
fix(test): add textBetween/nodesBetween to remap-length tr.doc mock (#2834)
Same root cause as the other three files — the word-diff trim in executor.ts calls tr.doc.textBetween and charOffsetToDocPos (which uses tr.doc.nodesBetween). The remap-length mock needs: - textBetween returning a range-sized unique string (no common prefix/suffix with any replacement) so the trim is a no-op - nodesBetween simulating a single text node so charOffsetToDocPos maps offsets correctly
1 parent 98b463a commit 29c1a7a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/remap-length.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ function makeTr() {
123123
docChanged: true,
124124
doc: {
125125
resolve: () => ({ marks: () => [] }),
126+
textBetween: vi.fn((from: number, to: number) => '\x01'.repeat(to - from)),
127+
nodesBetween: vi.fn((from: number, to: number, cb: (node: any, pos: number) => void) => {
128+
cb({ isText: true, nodeSize: to - from }, from);
129+
}),
126130
},
127131
};
128132
tr.replaceWith.mockReturnValue(tr);

0 commit comments

Comments
 (0)