fix tests

This commit is contained in:
Peter Savchenko 2023-12-20 04:31:34 +03:00
parent 25d52b0d46
commit 9051ca7483
No known key found for this signature in database
GPG key ID: E68306B1AB0F727C
3 changed files with 8 additions and 4 deletions

View file

@ -217,7 +217,6 @@ export default class BlockEvents extends Module {
return;
}
this.Editor.BlockSelection.clearSelection();
this.activateBlockSettings();
}
@ -228,6 +227,10 @@ export default class BlockEvents extends Module {
const currentBlock = this.Editor.BlockManager.currentBlock;
const canOpenToolbox = currentBlock.isEmpty;
/**
* @todo Handle case when slash pressed when several blocks are selected
*/
/**
* Toolbox will be opened only if Block is empty
*/

View file

@ -433,7 +433,7 @@ export default class Caret extends Module {
* @param {boolean} force - pass true to skip check for caret position
*/
public navigateNext(force = false): boolean {
const { BlockManager, BlockSelection } = this.Editor;
const { BlockManager } = this.Editor;
const { currentBlock, nextBlock } = BlockManager;
const { nextInput } = currentBlock;
const isAtEnd = this.isAtEnd;

View file

@ -38,7 +38,7 @@ class SomePlugin {
describe('Flipper', () => {
it('should prevent plugins event handlers from being called while keyboard navigation', () => {
const TAB_KEY_CODE = 9;
const SLASH_KEY_CODE = 191;
const ARROW_DOWN_KEY_CODE = 40;
const ENTER_KEY_CODE = 13;
@ -63,6 +63,7 @@ describe('Flipper', () => {
cy.get('[data-cy=editorjs]')
.get('.cdx-some-plugin')
.as('pluginInput')
.focus()
.type(sampleText)
.wait(100);
@ -71,7 +72,7 @@ describe('Flipper', () => {
cy.get('[data-cy=editorjs]')
.get('.cdx-some-plugin')
// Open tunes menu
.trigger('keydown', { keyCode: TAB_KEY_CODE })
.trigger('keydown', { keyCode: SLASH_KEY_CODE, ctrlKey: true })
// Navigate to delete button (the second button)
.trigger('keydown', { keyCode: ARROW_DOWN_KEY_CODE })
.trigger('keydown', { keyCode: ARROW_DOWN_KEY_CODE });