diff --git a/docs/src/demos/Extensions/Document/index.spec.js b/docs/src/demos/Extensions/Document/index.spec.js new file mode 100644 index 00000000..85a66e41 --- /dev/null +++ b/docs/src/demos/Extensions/Document/index.spec.js @@ -0,0 +1,37 @@ +context('/api/extensions/bold', () => { + beforeEach(() => { + cy.visit('/api/extensions/bold') + + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.setContent('
Example Text
') + editor.focus().selectAll() + }) + }) + + describe('bold', () => { + it('the button should make the selected text bold', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('strong', 'Example Text') + }) + + it('the button should toggle the selected text bold', () => { + cy.get('.demo__preview button:first').dblclick({ force: true }) + cy.get('.ProseMirror strong').should('not.exist') + }) + + it('the keyboard shortcut should make the selected text bold', () => { + const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b' + + cy.get('.ProseMirror').type(shortcut, {force: true}) + cy.get('.ProseMirror').contains('strong', 'Example Text') + }) + + it('the keyboard shortcut should toggle the selected text bold', () => { + const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b' + + cy.get('.ProseMirror').type(shortcut, {force: true}).type(shortcut, {force: true}) + cy.get('.ProseMirror strong').should('not.exist') + }) + }) +}) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Document/index.vue b/docs/src/demos/Extensions/Document/index.vue new file mode 100644 index 00000000..dfb3d3ea --- /dev/null +++ b/docs/src/demos/Extensions/Document/index.vue @@ -0,0 +1,44 @@ + +