From a44b31c9390c9deeaec50a0c31437342ef4864e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 14 Nov 2018 00:00:21 +0100 Subject: [PATCH] add update callback test --- packages/tiptap/test/Editor.spec.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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) +})