add update callback test

This commit is contained in:
Philipp Kühn 2018-11-14 00:00:21 +01:00
parent c0d853ff0e
commit a44b31c939

View File

@ -212,3 +212,29 @@ test('init callback', done => {
editor.destroy()
})
test('update callback', done => {
const editor = new Editor({
content: '<p>Foo</p>',
onUpdate: ({ getHTML, getJSON }) => {
expect(getHTML()).toEqual('<p>Bar</p>')
expect(getJSON()).toEqual({
type: 'doc',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Bar',
},
],
},
],
})
done()
},
})
editor.setContent('<p>Bar</p>', true)
})