lexical
lexical copied to clipboard
refactor: replace insertText from #6553 changes to reflect new removeText feature
This PR aims to Refactor #6553 : simplified insertText rewrite (part 2)
Right now, without changing the commented code that uses the new removeText feature. It passes almost all the tests except 2 cases
● LexicalSelectionHelpers tests › Collapsed › Can handle a text point
expect(received).toBe(expected) // Object.is equality
Expected: "Testa"
Received: "a"
148 | selection.insertText('Test');
149 |
> 150 | expect($getNodeByKey('a')!.getTextContent()).toBe('Testa');
| ^
151 |
152 | expect(selection.anchor).toEqual(
153 | expect.objectContaining({
● LexicalSelectionHelpers tests › Simple range › Can handle multiple text points
expect(received).toBe(expected) // Object.is equality
Expected: "Test"
Received: ""
1352 | selection.insertText('Test');
1353 |
> 1354 | expect($getNodeByKey('a')!.getTextContent()).toBe('Test');
| ^
1355 |
1356 | expect(selection.anchor).toEqual(
1357 | expect.objectContaining({
I will be investigating why this is the issue and as @GermanJablo said, i will make some refinements to his draft insertText
to fix those errors