From dd568dedeafbd1672b3c553afadb59423346fe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 5 May 2021 20:40:41 +0200 Subject: [PATCH] test: fix readonly test --- docs/src/demos/Guide/Content/ReadOnly/index.spec.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/src/demos/Guide/Content/ReadOnly/index.spec.js b/docs/src/demos/Guide/Content/ReadOnly/index.spec.js index 17cc73cf..60522041 100644 --- a/docs/src/demos/Guide/Content/ReadOnly/index.spec.js +++ b/docs/src/demos/Guide/Content/ReadOnly/index.spec.js @@ -1,12 +1,18 @@ context('/demos/Guide/Content/ReadOnly', () => { - beforeEach(() => { + before(() => { cy.visit('/demos/Guide/Content/ReadOnly') }) + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.clearContent() + }) + }) + it('should be read-only', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setEditable(false) - editor.commands.insertContent('Edited: ') + cy.get('.ProseMirror').type('Edited: ') cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ') }) @@ -15,7 +21,7 @@ context('/demos/Guide/Content/ReadOnly', () => { it('should be editable', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setEditable(true) - editor.commands.insertContent('Edited: ') + cy.get('.ProseMirror').type('Edited: ') cy.get('.ProseMirror p:first').should('contain', 'Edited: ') })