added test cases for white spaces at start of block

This commit is contained in:
Vikram Reddy 2023-08-20 20:38:35 +05:30
parent 9a16345639
commit 146a7b9a6c
2 changed files with 51 additions and 0 deletions

View file

@ -56,6 +56,31 @@ describe('Backspace keydown', function () {
.should('have.text', 'The second bloc'); // last char is removed
});
it('should just delete preceding white spaces (native behaviour) on click of backspace when Caret is not at the start of the Block', function () {
createEditorWithTextBlocks([
'The first block',
'The second block',
]);
cy.get('[data-cy=editorjs]')
.find('.ce-paragraph')
.last()
.click()
.type('{home}')
.type(' ') // adding space at the start of the block
.type('{backspace}');
cy.get('[data-cy=editorjs]')
.find('div.ce-block')
.last()
.should('have.text', `The second block`);
cy.get('[data-cy=editorjs]')
.find('div.ce-block')
.first()
.should('have.text', `The first block`);
});
it('should navigate previous input when Caret is not at the first input', function () {
/**
* Mock of tool with several inputs

View file

@ -57,6 +57,32 @@ describe('Delete keydown', function () {
.should('have.text', 'The first bloc'); // last char is removed
});
it('should just delete preceding white space (native behaviour) when Caret is not at the end of the Block', function () {
createEditorWithTextBlocks([
'The first block',
'The second block',
]);
cy.get('[data-cy=editorjs]')
.find('.ce-paragraph')
.last()
.click()
.type('{home}')
.type(' ') // adding space at the start of the block
.type('{leftarrow}') // now caret is at the start of the block
.type('{del}');
cy.get('[data-cy=editorjs]')
.find('div.ce-block')
.last()
.should('have.text', `The second block`);
cy.get('[data-cy=editorjs]')
.find('div.ce-block')
.first()
.should('have.text', `The first block`);
});
it('should navigate next input when Caret is not at the last input', function () {
/**
* Mock of tool with several inputs