test: fix readonly test

This commit is contained in:
Philipp Kühn
2021-05-05 20:40:41 +02:00
parent db1b957974
commit dd568dedea

View File

@@ -1,12 +1,18 @@
context('/demos/Guide/Content/ReadOnly', () => { context('/demos/Guide/Content/ReadOnly', () => {
beforeEach(() => { before(() => {
cy.visit('/demos/Guide/Content/ReadOnly') cy.visit('/demos/Guide/Content/ReadOnly')
}) })
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should be read-only', () => { it('should be read-only', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setEditable(false) editor.setEditable(false)
editor.commands.insertContent('Edited: ') cy.get('.ProseMirror').type('Edited: ')
cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ') cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ')
}) })
@@ -15,7 +21,7 @@ context('/demos/Guide/Content/ReadOnly', () => {
it('should be editable', () => { it('should be editable', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setEditable(true) editor.setEditable(true)
editor.commands.insertContent('Edited: ') cy.get('.ProseMirror').type('Edited: ')
cy.get('.ProseMirror p:first').should('contain', 'Edited: ') cy.get('.ProseMirror p:first').should('contain', 'Edited: ')
}) })