2022-11-25 18:56:50 +01:00
|
|
|
// eslint-disable-next-line spaced-comment, @typescript-eslint/triple-slash-reference
|
2020-11-21 19:01:31 +01:00
|
|
|
/// <reference path="../support/index.d.ts" />
|
|
|
|
|
|
|
|
describe('Editor basic initialization', () => {
|
|
|
|
describe('Zero-config initialization', () => {
|
|
|
|
/**
|
|
|
|
* In this test suite we use zero (omitted) configuration
|
|
|
|
*/
|
|
|
|
const editorConfig = {};
|
|
|
|
|
2022-11-25 18:56:50 +01:00
|
|
|
beforeEach(function () {
|
|
|
|
cy.createEditor(editorConfig).as('editorInstance');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
if (this.editorInstance) {
|
2020-11-21 19:01:31 +01:00
|
|
|
this.editorInstance.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create a visible UI', () => {
|
2021-02-18 16:22:55 +01:00
|
|
|
/**
|
|
|
|
* Assert if created instance is visible or not.
|
|
|
|
*/
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
|
|
.get('div.codex-editor')
|
|
|
|
.should('be.visible');
|
2020-11-21 19:01:31 +01:00
|
|
|
});
|
|
|
|
});
|
2022-02-09 18:46:26 +01:00
|
|
|
|
|
|
|
describe('Configuration', () => {
|
|
|
|
describe('readOnly', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
if (this && this.editorInstance) {
|
|
|
|
this.editorInstance.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create editor without editing ability when true passed', () => {
|
|
|
|
cy.createEditor({
|
|
|
|
readOnly: true,
|
|
|
|
}).as('editorInstance');
|
|
|
|
|
|
|
|
cy.get('[data-cy=editorjs]')
|
|
|
|
.get('div.codex-editor')
|
|
|
|
.get('div.ce-paragraph')
|
|
|
|
.invoke('attr', 'contenteditable')
|
|
|
|
.should('eq', 'false');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-11-21 19:01:31 +01:00
|
|
|
});
|