prosekit/core/test
Extends Editor<E>
An editor for testing purposes.
-
constructor
-
new TestEditor<E extends Extension<ExtensionTyping<any, any, any>>>(instance: EditorInstance): TestEditor<E>
-
dispatchEvent
-
const dispatchEvent: (event: Event) => void
-
set
-
Set the editor state to the given document. You can use special tokens
<a>
and<b>
to set the anchor and head positions of the selection.Example
const editor = createTestEditor({ extension }) const n = editor.nodes const doc = n.doc(n.paragraph('<a>Hello<b> world!')) editor.set(doc) // "Hello" is selected.
const set: (doc: ProseMirrorNode) => void
function createTestEditor<E extends Extension<ExtensionTyping<any, any, any>>>(options: EditorOptions<E>): TestEditor<E>