editor.js/test/cypress/tests/initialization.spec.ts
Peter Savchenko 3272efc3f7
chore(linting): eslint updated, code linted (#2174)
* update eslint + autofix

* a bunch of eslint fixes

* some spelling & eslint fixes

* fix some eslint errors and spells

* Update __module.ts

* a bunch of eslint fixes in tests

* Update cypress.yml

* Update cypress.yml

* fix cypress docker image name

* fixes for tests

* more tests fixed

* rm rule ignore

* rm another ignored rule

* Update .eslintrc
2022-11-25 21:56:50 +04:00

53 lines
1.3 KiB
TypeScript

// eslint-disable-next-line spaced-comment, @typescript-eslint/triple-slash-reference
/// <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 = {};
beforeEach(function () {
cy.createEditor(editorConfig).as('editorInstance');
});
afterEach(function () {
if (this.editorInstance) {
this.editorInstance.destroy();
}
});
it('should create a visible UI', () => {
/**
* Assert if created instance is visible or not.
*/
cy.get('[data-cy=editorjs]')
.get('div.codex-editor')
.should('be.visible');
});
});
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');
});
});
});
});