From 399be73e7b20a18df1919af706b53c10c61dd65a Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Wed, 19 Aug 2020 17:55:08 +0200 Subject: [PATCH] add read-only test --- docs/src/demos/ReadOnly/index.spec.js | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/src/demos/ReadOnly/index.spec.js b/docs/src/demos/ReadOnly/index.spec.js index 33182594..96d2394d 100644 --- a/docs/src/demos/ReadOnly/index.spec.js +++ b/docs/src/demos/ReadOnly/index.spec.js @@ -2,4 +2,34 @@ context('read-only', () => { beforeEach(() => { cy.visit('/examples/read-only') }) + + + describe('editable', () => { + it('should be editable', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + + cy.get('#editable').check() + + editor.insertText('Edited: ') + + cy.get('.ProseMirror h2:first') + .should('contain', 'Edited: ') + }) + }) + + it('should be read-only', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + + cy.get('#editable').uncheck() + + editor.insertText('Edited: ') + + cy.get('.ProseMirror h2:first') + .should('not.contain', 'Edited: ') + }) + }) + + }) }) \ No newline at end of file