mirror of
https://github.com/codex-team/editor.js
synced 2026-03-18 00:19:53 +01:00
* data-empty mark * Update CHANGELOG.md * lint * tests added * Update DataEmpty.cy.ts * lint * fix tests * Update Placeholders.cy.ts * upd paragraph * rm redundant test * lint fix * disable test for firefox
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
import { createEditorWithTextBlocks } from '../../support/utils/createEditorWithTextBlocks';
|
|
|
|
describe('inputs [data-empty] mark', function () {
|
|
it('should be added to inputs of editor on initialization', function () {
|
|
createEditorWithTextBlocks([
|
|
'First', // not empty block
|
|
'', // empty block
|
|
]);
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.first()
|
|
.should('have.attr', 'data-empty', 'false');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.should('have.attr', 'data-empty', 'true');
|
|
});
|
|
|
|
it('should be added as "false" to the input on typing', function () {
|
|
createEditorWithTextBlocks([
|
|
'First', // not empty block
|
|
'', // empty block
|
|
]);
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.type('Some text');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.should('have.attr', 'data-empty', 'false');
|
|
});
|
|
|
|
it('should be added as "true" to the input on chars removal', function () {
|
|
createEditorWithTextBlocks([
|
|
'', // empty block
|
|
'Some text', // not empty block
|
|
]);
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.type('{selectall}{backspace}');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.should('have.attr', 'data-empty', 'true');
|
|
});
|
|
|
|
it('should be added to the new block inputs', function () {
|
|
createEditorWithTextBlocks([
|
|
'First', // not empty block
|
|
'', // empty block
|
|
]);
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.type('{enter}');
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
.find('.ce-paragraph')
|
|
.last()
|
|
.should('have.attr', 'data-empty', 'true');
|
|
});
|
|
});
|