describe('Output sanitisation', () => { beforeEach(() => { if (this && this.editorInstance) { this.editorInstance.destroy(); } else { cy.createEditor({}).as('editorInstance'); } }); context('Output should save inline formatting', () => { it('should save initial formatting for paragraph', () => { cy.createEditor({ data: { blocks: [ { type: 'paragraph', data: { text: 'Bold text' }, } ], }, }).then(async editor => { const output = await (editor as any).save(); const boldText = output.blocks[0].data.text; expect(boldText).to.eq('Bold text'); }); }); it('should save formatting for paragraph', () => { cy.get('[data-cy=editorjs]') .get('div.ce-block') .click() .type('This text should be bold.{selectall}'); cy.get('[data-cy=editorjs]') .get('button.ce-inline-tool--bold') .click(); cy.get('[data-cy=editorjs]') .get('div.ce-block') .click(); cy.get('@editorInstance').then(async editorInstance => { const output = await (editorInstance as any).save(); const text = output.blocks[0].data.text; expect(text).to.eq('This text should be bold.'); }); }); it('should save formatting for paragraph on paste', () => { cy.get('[data-cy=editorjs]') .get('div.ce-block') .paste({ 'text/html': '

Text

Bold text

' }); cy.get('@editorInstance').then(async editorInstance => { const output = await (editorInstance as any).save(); const boldText = output.blocks[1].data.text; expect(boldText).to.eq('Bold text'); }); }); }); });