From c6dcacdc19988d0e4b93c7c276756776eec5c449 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Thu, 20 Aug 2020 18:00:35 +0200 Subject: [PATCH] add tests to export html and json --- .../Examples/ExportHtmlOrJson/index.spec.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js index 6f8fde42..34606b8b 100644 --- a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js +++ b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js @@ -2,4 +2,63 @@ context('export-html-or-json', () => { beforeEach(() => { cy.visit('/examples/export-html-or-json') }) + + describe('export', () => { + it('should return json', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const json = editor.json() + + expect(json).to.deep.equal({ + 'type': 'document', + 'content': [ + { + 'type': 'paragraph', + 'content': [ + { + 'type': 'text', + 'text': 'You are able to export your data as ' + }, + { + 'type': 'text', + 'marks': [ + { + 'type': 'code' + } + ], + 'text': 'HTML' + }, + { + 'type': 'text', + 'text': ' or ' + }, + { + 'type': 'text', + 'marks': [ + { + 'type': 'code' + } + ], + 'text': 'JSON' + }, + { + 'type': 'text', + 'text': '.' + } + ] + } + ] + }) + }) + }) + + it('should return html', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() + + expect(html).to.equal('

You are able to export your data as HTML or JSON.

') + }) + }) + }) }) \ No newline at end of file