diff --git a/docs/src/demos/Extensions/Italic/index.spec.js b/docs/src/demos/Extensions/Italic/index.spec.js new file mode 100644 index 00000000..f8ecc642 --- /dev/null +++ b/docs/src/demos/Extensions/Italic/index.spec.js @@ -0,0 +1,26 @@ +context('/api/extensions/italic', () => { + beforeEach(() => { + cy.visit('/api/extensions/italic') + + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.setContent('

Example Text

') + editor.focus().selectAll() + }) + }) + + describe('italic', () => { + it('should make the selected text italic', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('em', 'Example Text') + + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror em').should('not.exist') + }) + + it('should toggle the selected text italic', () => { + cy.get('.demo__preview button:first').dblclick({ force: true }) + cy.get('.ProseMirror em').should('not.exist') + }) + }) +}) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Italic/index.vue b/docs/src/demos/Extensions/Italic/index.vue index ed4b8593..65e46a82 100644 --- a/docs/src/demos/Extensions/Italic/index.vue +++ b/docs/src/demos/Extensions/Italic/index.vue @@ -42,6 +42,8 @@ export default {

This as well.

`, }) + + window.editor = this.editor }, beforeDestroy() {