Skip to content

Commit 4423629

Browse files
committed
Instead of a new class for NestedEditor an existing was used
1 parent 95f2def commit 4423629

File tree

2 files changed

+28
-172
lines changed

2 files changed

+28
-172
lines changed

test/cypress/fixtures/tools/NestedEditorTool.ts

Lines changed: 0 additions & 123 deletions
This file was deleted.

test/cypress/tests/modules/Ui.cy.ts

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createEditorWithTextBlocks } from '../../support/utils/createEditorWithTextBlocks';
22
import type EditorJS from '../../../../types/index';
3-
import { NestedEditorTool } from '../../fixtures/tools/NestedEditorTool';
3+
import NestedEditor, { NESTED_EDITOR_ID } from '../../support/utils/nestedEditorInstance';
44

55
describe('Ui module', function () {
66
describe('documentKeydown', function () {
@@ -142,58 +142,37 @@ describe('Ui module', function () {
142142
});
143143

144144
it('click on block of nested editor should also set the block of parent editor as current', function () {
145-
cy.window()
146-
.then((window) => {
147-
const editorJsClass = window.EditorJS;
148-
149-
cy.createEditor({
150-
tools: {
151-
nestedEditor: {
152-
class: NestedEditorTool,
153-
config: {
154-
editorLibrary: editorJsClass
155-
}
145+
cy.createEditor({
146+
tools: {
147+
nestedEditor: {
148+
class: NestedEditor,
149+
},
150+
},
151+
data: {
152+
blocks: [
153+
{
154+
type: 'paragraph',
155+
data: {
156+
text: 'First block of parent editor',
156157
},
157158
},
158-
data: {
159-
blocks: [
160-
{
161-
id: 'block1',
162-
type: 'paragraph',
163-
data: {
164-
text: 'First block of parent editor',
165-
},
166-
},
167-
{
168-
id: 'block2',
169-
type: 'paragraph',
170-
data: {
171-
text: 'Second block of parent editor',
172-
},
173-
},
174-
{
175-
id: 'block3',
176-
type: 'nestedEditor',
177-
data: {
178-
nestedEditor: {
179-
blocks: [
180-
{
181-
id: 'nestedBlock1',
182-
type: 'paragraph',
183-
data: {
184-
text: 'First block of nested editor',
185-
},
186-
}
187-
]
188-
}
189-
}
190-
}
191-
],
159+
{
160+
type: 'paragraph',
161+
data: {
162+
text: 'Second block of parent editor',
163+
},
192164
},
193-
}).as('editorInstance');
194-
});
165+
{
166+
type: 'nestedEditor',
167+
data: {
168+
text: 'First block of nested editor',
169+
},
170+
},
171+
],
172+
},
173+
}).as('editorInstance');
195174

196-
cy.get('[data-id=nestedBlock1]')
175+
cy.get(`[data-cy=${NESTED_EDITOR_ID}]`)
197176
.find('.ce-paragraph')
198177
.click();
199178

0 commit comments

Comments
 (0)