diff --git a/demos/src/Examples/Minimal/Vue/index.spec.js b/demos/src/Examples/Minimal/Vue/index.spec.js index 2b6eeee0..32275026 100644 --- a/demos/src/Examples/Minimal/Vue/index.spec.js +++ b/demos/src/Examples/Minimal/Vue/index.spec.js @@ -3,5 +3,45 @@ context('/src/Examples/Minimal/Vue/', () => { cy.visit('/src/Examples/Minimal/Vue/') }) - // TODO: Write tests + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.clearContent() + }) + }) + + it('text should be wrapped in a paragraph by default', () => { + cy.get('.ProseMirror') + .type('Example Text') + .find('p') + .should('contain', 'Example Text') + }) + + it('should parse paragraphs correctly', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('

Example Text

') + expect(editor.getHTML()).to.eq('

Example Text

') + + editor.commands.setContent('

Example Text

') + expect(editor.getHTML()).to.eq('

Example Text

') + }) + }) + + it('enter should make a new paragraph', () => { + cy.get('.ProseMirror') + .type('First Paragraph{enter}Second Paragraph') + .find('p') + .should('have.length', 2) + }) + + it('backspace should remove the last paragraph', () => { + cy.get('.ProseMirror') + .type('{enter}') + .find('p') + .should('have.length', 2) + + cy.get('.ProseMirror') + .type('{backspace}') + .find('p') + .should('have.length', 1) + }) })