2021-07-21 20:33:09 +02:00
|
|
|
import * as _ from '../../../src/components/utils';
|
|
|
|
|
|
|
|
describe('Blocks selection', () => {
|
2022-11-25 18:56:50 +01:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.createEditor({}).as('editorInstance');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
if (this.editorInstance) {
|
2021-07-21 20:33:09 +02:00
|
|
|
this.editorInstance.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should remove block selection on click', () => {
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
|
|
.find('div.ce-block')
|
|
|
|
.click()
|
|
|
|
.type('First block{enter}');
|
|
|
|
|
|
|
|
cy.get('[data-cy=editorjs')
|
|
|
|
.find('div.ce-block')
|
|
|
|
.next()
|
|
|
|
.type('Second block')
|
|
|
|
.type('{movetostart}')
|
|
|
|
.trigger('keydown', {
|
|
|
|
shiftKey: true,
|
|
|
|
keyCode: _.keyCodes.UP,
|
|
|
|
});
|
|
|
|
|
|
|
|
cy.get('[data-cy=editorjs')
|
|
|
|
.click()
|
|
|
|
.find('div.ce-block')
|
|
|
|
.should('not.have.class', '.ce-block--selected');
|
|
|
|
});
|
|
|
|
});
|