mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 23:15:15 +08:00
Add russian undo/redo shortcuts and fix tests
This commit is contained in:
parent
6ca7ebde55
commit
a331d72383
@ -1,9 +1,6 @@
|
|||||||
context('/demos/Extensions/History', () => {
|
context('/demos/Extensions/History', () => {
|
||||||
before(() => {
|
|
||||||
cy.visit('/demos/Extensions/History')
|
|
||||||
})
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
cy.visit('/demos/Extensions/History')
|
||||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||||
editor.commands.setContent('<p>Mistake</p>')
|
editor.commands.setContent('<p>Mistake</p>')
|
||||||
})
|
})
|
||||||
@ -20,12 +17,54 @@ context('/demos/Extensions/History', () => {
|
|||||||
.should('not.contain', 'Mistake')
|
.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')
|
cy.get('.ProseMirror')
|
||||||
.trigger('keydown', { modKey: true, key: 'z' })
|
|
||||||
.should('not.contain', 'Mistake')
|
.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', () => {
|
it('should apply the last undone change again', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.should('contain', 'Mistake')
|
.should('contain', 'Mistake')
|
||||||
@ -42,12 +81,4 @@ context('/demos/Extensions/History', () => {
|
|||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.should('contain', 'Mistake')
|
.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')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
@ -49,8 +49,10 @@ export const History = Extension.create<HistoryOptions>({
|
|||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
'Mod-z': () => this.editor.commands.undo(),
|
'Mod-z': () => this.editor.commands.undo(),
|
||||||
|
'Mod-я': () => this.editor.commands.undo(),
|
||||||
'Mod-y': () => this.editor.commands.redo(),
|
'Mod-y': () => this.editor.commands.redo(),
|
||||||
'Shift-Mod-z': () => this.editor.commands.redo(),
|
'Shift-Mod-z': () => this.editor.commands.redo(),
|
||||||
|
'Shift-Mod-я': () => this.editor.commands.redo(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user