diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index e1ee5b9af..cd4f43d6b 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -1,9 +1,6 @@ context('/demos/Extensions/History', () => { - before(() => { - cy.visit('/demos/Extensions/History') - }) - beforeEach(() => { + cy.visit('/demos/Extensions/History') cy.get('.ProseMirror').then(([{ editor }]) => { editor.commands.setContent('

Mistake

') }) @@ -20,12 +17,54 @@ context('/demos/Extensions/History', () => { .should('not.contain', 'Mistake') }) - it('the keyboard shortcut should make the last change undone', () => { + it('should make the last change undone with the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, key: 'z' }) + + cy.get('.ProseMirror') - .trigger('keydown', { modKey: true, key: 'z' }) .should('not.contain', 'Mistake') }) + it('should make the last change undone with the keyboard shortcut (russian)', () => { + cy.get('.ProseMirror') + .should('contain', 'Mistake') + + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, key: 'я' }) + + cy.get('.ProseMirror') + .should('not.contain', 'Mistake') + }) + + it('should apply the last undone change again with the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, key: 'z' }) + + cy.get('.ProseMirror') + .should('not.contain', 'Mistake') + + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, shiftKey: true, key: 'z' }) + + cy.get('.ProseMirror') + .should('contain', 'Mistake') + }) + + it('should apply the last undone change again with the keyboard shortcut (russian)', () => { + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, key: 'я' }) + + cy.get('.ProseMirror') + .should('not.contain', 'Mistake') + + cy.get('.ProseMirror') + .trigger('keydown', {modKey: true, shiftKey: true, key: 'я' }) + + cy.get('.ProseMirror') + .should('contain', 'Mistake') + }) + it('should apply the last undone change again', () => { cy.get('.ProseMirror') .should('contain', 'Mistake') @@ -42,12 +81,4 @@ context('/demos/Extensions/History', () => { cy.get('.ProseMirror') .should('contain', 'Mistake') }) - - it.skip('the keyboard shortcut should apply the last undone change again', () => { - cy.get('.ProseMirror') - .trigger('keydown', { modKey: true, key: 'z' }) - .should('not.contain', 'Mistake') - .trigger('keydown', { modKey: true, shiftKey: true, key: 'z' }) - .should('contain', 'Mistake') - }) }) diff --git a/packages/extension-history/src/history.ts b/packages/extension-history/src/history.ts index dfaa96224..6739607ed 100644 --- a/packages/extension-history/src/history.ts +++ b/packages/extension-history/src/history.ts @@ -49,8 +49,10 @@ export const History = Extension.create({ addKeyboardShortcuts() { return { 'Mod-z': () => this.editor.commands.undo(), + 'Mod-я': () => this.editor.commands.undo(), 'Mod-y': () => this.editor.commands.redo(), 'Shift-Mod-z': () => this.editor.commands.redo(), + 'Shift-Mod-я': () => this.editor.commands.redo(), } }, })