mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-05 04:19:07 +08:00
add update callback test
This commit is contained in:
parent
c0d853ff0e
commit
a44b31c939
@ -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)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user