I try to write tests for editor, and for the sake of tests I’d like to fake input into the editor.
For tests of state, I managed to fake it by calling:
return ({state, dispatch}) => dispatch({userEvent: 'input.type', ...state.replaceSelection(letter)});
but how can I fake input for view?
- should i just replace
.innerHtml
of.cm-content
and then manually call"input"
event? - should I just change particular
.cm-line
? - try to approach it from
MutationObserver
way?
I’m happy to write code that can “simulate” a browser, but my question is - what behaviour exactly does code mirror rely on input?