diff --git a/packages/tiptap/test/Editor.spec.js b/packages/tiptap/test/Editor.spec.js index 9f7708c1..fef31a0b 100644 --- a/packages/tiptap/test/Editor.spec.js +++ b/packages/tiptap/test/Editor.spec.js @@ -212,3 +212,29 @@ test('init callback', done => { editor.destroy() }) + +test('update callback', done => { + const editor = new Editor({ + content: '
Foo
', + onUpdate: ({ getHTML, getJSON }) => { + expect(getHTML()).toEqual('Bar
') + expect(getJSON()).toEqual({ + type: 'doc', + content: [ + { + type: 'paragraph', + content: [ + { + type: 'text', + text: 'Bar', + }, + ], + }, + ], + }) + done() + }, + }) + + editor.setContent('Bar
', true) +})