From ca19923ad2617967ffd09b122170646b7ebe2ca8 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 26 Feb 2021 02:02:10 +0100 Subject: [PATCH] copy tests to the React default example --- .../Examples/Default/React/index.spec.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/src/demos/Examples/Default/React/index.spec.js diff --git a/docs/src/demos/Examples/Default/React/index.spec.js b/docs/src/demos/Examples/Default/React/index.spec.js new file mode 100644 index 00000000..350c2d41 --- /dev/null +++ b/docs/src/demos/Examples/Default/React/index.spec.js @@ -0,0 +1,22 @@ +context('/demos/Examples/Default/React', () => { + before(() => { + cy.visit('/demos/Examples/Default/React') + }) + + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('

Example Text

') + cy.get('.ProseMirror').type('{selectall}') + }) + }) + + it('should apply the paragraph style when the keyboard shortcut is pressed', () => { + cy.get('.ProseMirror h1').should('exist') + cy.get('.ProseMirror p').should('not.exist') + + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, altKey: true, key: '0' }) + .find('p') + .should('contain', 'Example Text') + }) +})