added test verifying that we're not opening toolbars on '/' if user clicked outside of the editor

This commit is contained in:
Kanstantsin_Vikhor 2024-03-01 16:43:27 +04:00
parent 63189a371d
commit 9ed922beb0

View file

@ -92,5 +92,58 @@ describe('Ui module', function () {
});
});
});
describe('Clicking outside', function () {
it('should clear current block even if selection was inside the editor before clicking', function () {
cy.createEditor({
data: {
blocks: [
{
id: 'block1',
type: 'paragraph',
data: {
text: '',
},
},
],
},
}).as('editorInstance');
cy.get('[data-cy=editorjs]')
.then(editor => {
const editorsParent = editor[0].parentNode;
const input = editorsParent.ownerDocument.createElement('div');
input.contentEditable = 'true';
input.style.width = '20px';
input.style.height = '20px';
input.setAttribute('data-cy', 'test-input');
editorsParent.appendChild(input);
});
/**
* Put cursor inside the editor
*/
cy.get('[data-cy=editorjs]')
.find('.ce-paragraph')
.first()
.click();
/**
* Click outside of the editor and type '/'
*/
cy.get('[data-cy=test-input]')
.click()
.type('/');
/**
* Toolbox shouldn't be open
*/
cy.get('[data-cy=editorjs]')
.get('div.ce-toolbox .ce-popover')
.should('not.be.visible');
});
});
});
});